RosettaCodeData/Task/Integer-comparison/Groovy/integer-comparison-3.groovy
2023-07-01 13:44:08 -04: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"
}