Exceptions: Difference between revisions
→{{header|langur}}
Alextretyak (talk | contribs) m (→{{header|11l}}: X.throw) |
Langurmonkey (talk | contribs) |
||
Line 1,598:
Exceptions in langur are hashes guaranteed to contain certain fields, even if they're empty.
<syntaxhighlight lang="langur">
catch
if .e
# change result...
} else {
Line 1,610 ⟶ 1,609:
} else {
# no exception
}
An else section on a catch is optional. You can also use else if.
Line 1,621 ⟶ 1,620:
catch {
if _err
# change result
123
} else {
# rethrow the exception
throw
}
}
<syntaxhighlight lang="langur">val .safediv =
.safediv(7, 7) # 1
.safediv(7, 0) # 0
</syntaxhighlight>
=={{header|Lasso}}==
|