DOCUMENTATION CENTER SEARCH
Mathematica
>
Conditionals
>
Built-in
Mathematica
Symbol
Conditionals
Piecewise Functions
Tutorials »
|
Switch
If
Piecewise
See Also »
|
Conditionals
Logic & Boolean Algebra
Procedural Programming
More About »
Which
Which
[
test
1
,
value
1
,
test
2
,
value
2
,
...
]
evaluates each of the
test
i
in turn, returning the value of the
value
i
corresponding to the first one that yields
True
.
MORE INFORMATION
Which
has attribute
HoldAll
.
If any of the
test
i
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
test
i
to be
True
.
If all the
test
i
evaluate to
False
,
Which
returns
Null
.
EXAMPLES
CLOSE ALL
Basic Examples
(1)
In[1]:=
Out[1]=
Scope
(2)
SEE ALSO
Switch
If
Piecewise
TUTORIALS
Conditionals
Piecewise Functions
MORE ABOUT
Conditionals
Logic & Boolean Algebra
Procedural Programming
New in 1
© 2008 Wolfram Research, Inc.