Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

Which

Usage

Which[ ,  ,  ,  , ... ] evaluates each of the  in turn, returning the value of the  corresponding to the first one that yields True.


Notes

• Example: Which[1Equal2, x, 1Equal1, y]LongRightArrow .
Which has attribute HoldAll.
• 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.
• If all the  evaluate to False, Which returns Null.
• See Section 2.6.8.
• See also: Switch, If, Piecewise.
• New in Version 1.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: