Groovy web console

subscribe to the feed Subscribe
to this
site

Groovy Elvis

Published 1 month ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
boolean hasProperty(String property) {
 return property == "x"
}

String x = hasProperty("x") ? "Stuff" : null
println(x)

String y = hasProperty("y") ? "Stuff" : null
println(y)

// This is not working 
//String y = if(hasProperty("y")) "Stuff" else null