Difference between revisions of "Finally"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "{{Finally}} The Reserved word '''finally''' identifies the block that should always be processed, regardless of whether an error has occurred or not. Example: <syntaxhig...")
 
Line 39: Line 39:
 
* [[Try]]
 
* [[Try]]
 
* [[Except]]
 
* [[Except]]
 +
* [[Avoiding implicit try finally section]]

Revision as of 13:28, 1 October 2018

Deutsch (de) English (en) suomi (fi)

The Reserved word finally identifies the block that should always be processed, regardless of whether an error has occurred or not.

Example:

begin
  ...
  try
    ... // Action
  finally
    ... // Final work, which should be done even in case of error
  end;
  ...
end;



Example (in this example, the finally block is always executed)::

begin
  ...
  try
    try
      ... // instructions to check
    except // error handling
      ...
    end;
  finally // always instructions to be processed
    ...
  end;
  ...
end;


See also