Groovy web console

subscribe to the feed Subscribe
to this
site
BigDecimalTruthy (via #groovywebconsole)
tweet this snippet Tweet
this
script

BigDecimalTruthy

Published 2 months ago by Kingpin
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
BigDecimal shouldFailTruthy = 0.0
BigDecimal shouldPassTruthy = 0.01

Boolean shouldFailTruthyResult = shouldFailTruthy && true
Boolean shouldPassTruthyResult = shouldPassTruthy && true

println "Truthy check using value of 0.0: " + shouldFailTruthyResult
println "Truthy check using value of 0.01: " + shouldPassTruthyResult