Exceptions: Difference between revisions

Content added Content deleted
(→‎shortened catch: .err to _err)
Line 1,534: Line 1,534:


A catch causes all the statements preceding it within a block to be the implicit try block.
A catch causes all the statements preceding it within a block to be the implicit try block.

An else section on a catch is optional (available from version 0.5.0 and higher).


<lang langur># do something
<lang langur># do something
Line 1,551: Line 1,549:
...
...
}</lang>
}</lang>

An else section on a catch is optional. As of 0.7, you can also use else if on a catch. The parser wraps it into the else block of the catch, so that it looks the same to the compiler and VM.


=== shortened catch ===
=== shortened catch ===