FINALLY
SUB Function(...)
...
FINALLY
...
END
This instruction introduces the code executed at the end of the function, even if a error was raised during its execution.
The FINALLY part is not mandatory.
If an error is raised during the execution of the FINALLY part, it is normally propagated.
If there is a catch part in the function, the FINALLY part must precede it.
This does not completely Ensure that the Finally code is always run regardless.
If
RETURN is used to exit a function before Finally then the Finally part will be missed.
Finally is primarily
Error Management so it is run if an error is raised or the code naturally reaches that point and not if the function exits before it is reached.
See
CATCH for more details and for a code example.
See also