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


Which[test1, value1, test2, value2, ...]
evaluates each of the testi in turn, returning the value of the valuei corresponding to the first one that yields True.
  • If any of the testi 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 testi to be True.
New in 1