RosettaCodeData/Task/Integer-comparison/Groovy/integer-comparison-3.groovy

5 lines
162 B
Groovy
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
final rels = [ (-1) : '<', 0 : '==', 1 : '>' ].asImmutable()
def comparisonSpaceship = { a, b ->
2013-04-10 21:29:02 -07:00
println "a ? b = ${a} ? ${b} = a ${rels[a <=> b]} b"
}