Finally
From Free Pascal wiki
Jump to navigationJump to search
│
Deutsch (de) │
English (en) │
suomi (fi) │
Back to Reserved words.
The reserved word finally
identifies a block of code that should always be processed, regardless of whether an error has occurred or not.
Examples
Simple example:
begin
...
try
... // code to check
finally
... // code which should always be executed even in case of error
end;
...
end;
Example with error handling:
begin
...
try
try
... // code to check
except
... // error handling
end;
finally
... // code which must always be executed even in case of error
end;
...
end;
Caveats
The finally
part is not executed if a halt
occurred.