Another way to use when
is to skip the initial expression. In that case,
what had been simple values (left hand side of the ->
cases) are now
boolean expressions. The first of those expressions to return true
is used;
if all return false
, the else
case is used (if there is one).
You can learn more about this in:
Tags: