3 ms·
Haskell has the exact same thing. It defines an alias for true called otherwise, so it would be if x > y -> true; otherwise -> false; end Using otherw
by tinco 14y ago
Haskell has the exact same thing. It defines an alias for true called otherwise, so it would be
if x > y ->
true;
otherwise ->
false;
end
Using otherwise makes it a loss less ugly, and I guess fixes the false cognate.
- Tyr42 14y agoI don't think that's valid Haskell. Examples of Haskell: case (x>y) of {True -> "Yup"; False -> "Nope");} or if (x>y) then "Yup" else "Nope" An example that uses otherwise would be fizzbuzz x | x `mod` 15 == 0 = "Fizzbuzz" | x `mod` 5 == 0 = "Buzz" | x `mod` 3 == 0 = "Fizz" | otherwise = show x -- This is x.to_string