Jump to content

Exceptions: Difference between revisions

m ("moved" SHORTENED CATCH to under the Langur language.)
Line 1,555:
A catch can be shortened by using a single expression that does not start with a variable name. This uses the implicit .err exception variable.
 
A shortened catch does not allow an else section (action for no exception).
 
<lang Langur>catch if .err["cat"] == "math" {
Line 1,563:
}</lang>
 
<lang Langur>val .safeDivsafediv = f { 7.x / .xy ; catch 0 }
.safeDivsafediv(7, 7) # 1
.safeDivsafediv(7, 0) # 0</lang>
 
=={{header|Lasso}}==
1,007

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.