Last active
August 29, 2015 13:59
-
-
Save danieldbower/10732400 to your computer and use it in GitHub Desktop.
Groovy Truth Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map vals = ['Zero':0, 'Negative decimal':-0.01, 'Negative decimal':-0.05, 'Negative whole number':-1, | |
'Negative decimal':-1.5, 'One':1, 'Positive decimal':0.01, 'Positive decimal':0.05, | |
'Positive decimal':1.5, 'Empty string':'', 'Empty list':[], 'Empty hash':[:], | |
'Lower character':'a', 'Upper character':'A', 'Null':null | |
] | |
vals.each{ k, v -> | |
println (v ? "$k ( $v ) is true" : "$k ( $v ) is false") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment