Exits from the current procedure.
In Delphi, the Exit procedure immediately passes control away from the current procedure. If the current procedure is the main program, Exit causes the program to terminate.
Exit causes the calling procedure to continue with the statement after the point at which the procedure was called.
Note: Exit passes control away from the current procedure, not merely the current block. However, Exit does not violate the flow of control dictated by a try..finally construct; if Exit is called inside the try clause, the finally clause is still executed.
Beginning with Delphi 2009, Exit can take a parameter specifying a result. The parameter must be of the same type as the result of the function. For example:
function DoSomething(aInteger: integer): string; begin if aInteger < 0 then begin Exit('Negative'); end; Result := 'Positive'; end;