Finally
From Lazarus wiki
Revision as of 16:21, 6 August 2022 by Kai Burghardt (talk | contribs) (resolve Category: Pages using deprecated enclose attributes)
│
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.