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

Documentation / Mathematica / Built-in Functions / Programming / Flow Control /

Which

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

FilledSmallSquare Example: Which[1==2, x, 1==1, y] LongRightArrow.

FilledSmallSquare Which has attribute HoldAll.

FilledSmallSquare If any of the evaluated by Which give neither True nor False, then a Which object containing these remaining elements is returned unevaluated.

FilledSmallSquare You can make Which return a "default value" by taking the last to be True.

FilledSmallSquare If all the evaluate to False, Which returns Null.

FilledSmallSquare See Section 2.6.8.

FilledSmallSquare See also: Switch, If.

FilledSmallSquare New in Version 1.

Further Examples



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


 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy | [ja] |
Sign up for our newsletter: