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

Content added Content deleted
(→‎{{header|Ruby}}: rescued, not caught.)
Line 1,992: Line 1,992:
foo
foo
foo </lang>
foo </lang>
The first call to foo causes the U0 exception. It gets caught and handled. The second call results in a U1 exception which is not caught, so the program dumps a stacktrace and exits.
The first call to foo causes the U0 exception. It gets rescued. The second call results in a U1 exception which is not rescued, so the program dumps a stacktrace and exits.
{{out}}
{{out}}
<pre>$ ruby test2.rb
<pre>$ ruby test2.rb