This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


evaluates each of the in turn, returning the value of the corresponding to the first one that yields True.
  • If any of the evaluated by Which give neither True nor False, then a Which object containing these remaining elements is returned unevaluated. »
  • You can make Which return a "default value" by taking the last to be True.
Which can be maintained in symbolic form:
Conditions are evaluated until one is found that is neither True nor False:
Use True for an else clause that always matches:
Define a piecewise function:
Expand it to use Piecewise:
Do symbolic operations:
Use Which rather than a nested if-then-elsif chain:
Use PiecewiseExpand to convert Which to Piecewise:
New in 1