Anonymous user
Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Exceptions/Catch an exception thrown in a nested call (view source)
Revision as of 07:10, 19 November 2012
, 11 years ago→{{header|Mathematica}}
(→{{header|Tcl}}: Add note: Both exceptions are caught and one is re-raised rather than only one being caught.) |
|||
Line 1,220:
errorexample.lua:34: in main chunk
[C]: ?</pre>
=={{header|Mathematica}}==
<lang mathematica>foo[] := Catch[ bar[1]; bar[2]; ]
bar[i_] := baz[i];
baz[i_] := Switch[i,
1, Throw["Exception U0 in baz"];,
2, Throw["Exception U1 in baz"];]</lang>
Output:
<pre> foo[]
-> Exception U0 in baz</pre>
=={{header|MATLAB}}==
|