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

5 lines
162 B
Groovy

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