When execution leaves any part of the Try
statement, the finally block is always guaranteed to be executed. No explicit action is required to make the finally block execute – when execution leaves the Try
statement, the system will execute the finally block and then transfer execution to its intended destination. Executing the finally block occurs regardless of the method in which the Try
statement is left: reaching the end of the try block, reaching the end of a catch block, executing an Exit
Try
statement, a GoTo
statement or not handling a thrown exception.
It is illegal to transfer execution out of a finally block except through an exception or to explicitly transfer execution into a finally block.
Finally
StatementTerminator