 |
Catch
Catch[
expr
] returns the argument of the first Throw generated in the evaluation of expr. Catch[
expr
,
form
] returns value from the first Throw[
value
,
tag
] for which form matches tag. Catch[
expr
,
form
,
f
] returns f
[
value
,
tag
].
Catch[
expr
, ... ] always returns the value of expr if no Throw was generated during the evaluation. form can be any expression, and is often a pattern. tag in Throw[
value
,
tag
] is re-evaluated every time it is compared to form. See the Mathematica book: Section 2.5.9. See also: Check, CheckAbort.
Further Examples
This function throws overflow if its argument is greater than 10.
In[1]:= 
g[20] throws overflow, which is returned as the value of the enclosing Catch.
In[2]:= 
Out[2]= 
In this case, overflow is not generated, and the Catch has no effect.
In[3]:= 
Out[3]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. | | | |
 | |
|