Exceptions: Difference between revisions
→{{header|langur}}: added curly braces to catch for clarity
(Applesoft BASIC) |
Langurmonkey (talk | contribs) (→{{header|langur}}: added curly braces to catch for clarity) |
||
Line 1,610:
An else section on a catch is optional. As of 0.7, you can also use else if on a catch.
===
<syntaxhighlight lang="langur">100 / 0
catch
if _err["cat"] == "math" {
# change result
123
throw
}
}</syntaxhighlight>
<syntaxhighlight lang="langur">val .safediv = f { .x / .y ; catch { 0 } }
.safediv(7, 7) # 1
.safediv(7, 0) # 0</syntaxhighlight>
|