|
SOLUTIONS
|
BUILT-IN MATHEMATICA SYMBOL
Switch
Switch[expr, form1, value1, form2, value2, ...]
evaluates expr, then compares it with each of the
in turn, evaluating and returning the
corresponding to the first match found.
DetailsDetails
- 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.
New in 1
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
