Created
November 6, 2016 18:56
-
-
Save okram999/ee352282ce516db7676afb16fdbb8763 to your computer and use it in GitHub Desktop.
Groovy Shorthands
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
Ternary Operators: | |
#1: | |
def s = "" | |
if (s != null && s.length() > 0) { | |
result = 'Found' | |
} | |
else { | |
result = 'Not Found' | |
} | |
#2: | |
def s = "" | |
result = (s != null && s.length() > 0) ? 'Found' : 'Not Found' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment