Integer comparison: Difference between revisions

(oberon-2)
Line 256:
let { b :: Integer; b = read b' }
putStrLn $ myCompare a b
 
However, the more idiomatic and less error-prone way to do it in Haskell would be to use a compare function that returns type Ordering, which is either LT, GT, or EQ:
myCompare a b = case compare a b of
LT -> "A is less than B"
GT -> "A is greater than B"
EQ -> "A equals B"
 
=={{header|J}}==
Anonymous user