Which[$cond_1$, $expr_1$, $cond_2$, $expr_2$, ...]True, $expr_2$ if $cond_2$ evaluates to True, etc.n = 5;
Which[n == 3, x, n == 5, y]
f[x_] := Which[x < 0, -x, x == 0, 0, x > 0, x]
f[-3]
If no test yields True, Which returns Null:
Which[False, a]
If a test does not evaluate to True or False, evaluation stops
and a Which expression containing the remaining cases is
returned:
Which[False, a, x, b, True, c]
Which must be called with an even number of arguments:
Which[a, b, c]