Exceptions/Catch an exception thrown in a nested call: Difference between revisions

(→‎{{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}}==