Created
September 18, 2013 12:41
-
-
Save namuan/6608612 to your computer and use it in GitHub Desktop.
Groovy return () if (condition)
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
def doSomething() { | |
"Doing something" | |
} | |
def ret(Closure c) { | |
[if: { condition -> | |
if (condition) c() | |
}] | |
} | |
println ret { | |
doSomething() | |
}.if(true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment