Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Content added Content deleted
(→{{header|Tcl}}: Add note: Both exceptions are caught and one is re-raised rather than only one being caught.) |
|||
Line 1,220: | Line 1,220: | ||
errorexample.lua:34: in main chunk |
errorexample.lua:34: in main chunk |
||
[C]: ?</pre> |
[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}}== |
=={{header|MATLAB}}== |