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

Switch

Usage

Switch[expr,  ,  ,  ,  , ... ] evaluates expr, then compares it with each of the  in turn, evaluating and returning the  corresponding to the first match found.


Notes

• Only the  corresponding to the first  that matches expr is evaluated. Each  is evaluated only when the match is tried.
• If the last  is the pattern _, then the corresponding  is always returned if this case is reached.
• If none of the  match expr, the Switch is returned unevaluated.
Switch has attribute HoldRest.
• You can use Break, Return and Throw in Switch.
• See Section 2.6.8.
• See also: If, Condition, Which, 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: