Go to the first, previous, next, last section, table of contents.

TRY-FINALLY Statement

The TRY-FINALLY statement guarantees that cleanup-statements are called, no matter what happens in the guarded-statements. If there was an exception raised in the guarded-statements, then the same exception is re-raised by TRY-FINALLY.

Note: The TRY-FINALLY statement catches internal exceptions raised by all EXIT and RETURN statements.


Example

TRY-FINALLY is quite useful for clean-up activities, like closing file handles:


Go to the first, previous, next, last section, table of contents.