RosettaCodeData/Task/Integer-comparison/Groovy/integer-comparison-3.groovy
2016-12-05 22:15:40 +01:00

4 lines
162 B
Groovy

final rels = [ (-1) : '<', 0 : '==', 1 : '>' ].asImmutable()
def comparisonSpaceship = { a, b ->
println "a ? b = ${a} ? ${b} = a ${rels[a <=> b]} b"
}