Try...Catch...Finally Statement

Lets you catch many errors that can occur in a given block of code.

Syntax

Try
    [ try_statements ]
[ Catch [ catch_parameter ]
    [ catch_statements ] ]
…
[ Finally
    [ finally_statements ] ]
End [ Try ]

Parts

try_statements
Optional statements in which errors can occur.
Catch
Optional, repeatable start of a block of statements that execute when an error occurs.
catch_parameter
Optional declaration of an object variable. The type of the object supplied to Throw selects the block (Catch) to execute.
If not given, then Catch will execute for all exceptions. This can be done only as the last Catch.
catch_statements
Optional statements that execute when an error occurs.
finally_statements
Optional statements that always execute. If an error occurred, the statements execute after Catch is done.
End
Completes the statement. You can also use End Try.
You can change this part of the syntax. See @Option Directive for more information.

Instructions

TODO

Examples

Try
    ' Cause a division by zero.
    x = a / 0
Catch #ex As Exception
    ' Do something about the error.
End Try

See also