Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) m (→{{header|11l}}: X.throw) |
Langurmonkey (talk | contribs) |
||
Line 2,074: | Line 2,074: | ||
val .U1 = h{"msg": "U1"} |
val .U1 = h{"msg": "U1"} |
||
val .baz = |
val .baz = fn(.i) throw if(.i==0: .U0; .U1) |
||
val .bar = |
val .bar = fn(.i) .baz(.i) |
||
val .foo = |
val .foo = impure fn() { |
||
for .i in [0, 1] { |
for .i in [0, 1] { |
||
.bar(.i) |
.bar(.i) |
||
catch { |
catch { |
||
if _err |
if _err'msg == .U0'msg { |
||
writeln "caught .U0 in .foo()" |
writeln "caught .U0 in .foo()" |
||
} else { |
} else { |
||
Line 2,090: | Line 2,090: | ||
} |
} |
||
.foo() |
.foo() |
||
</syntaxhighlight> |
|||
{{out}} |
{{out}} |