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 16:20, 9 December 2023
, 6 months ago→{{header|Sidef}}: updated code
m (→{{header|Wren}}: Changed to Wren S/H) |
m (→{{header|Sidef}}: updated code) |
||
Line 3,095:
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">func baz(i) { die "U#{i}" }
func bar(i) { baz(i) }
func foo {
[0, 1].each { |i|
try { bar(i) }
catch { |
msg ~~ /^U0/
}
}
}
foo()
{{out}}
<pre>
|