unit SystemHalt;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: SystemHalt
// Routine: System.Halt

// BeginCode
{
This example halts before the TextOut and terminates the
application.  Do not expect to one step this procedure.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
   if 1 = 1 then
     begin
       if 2 = 2 then
         begin
           if 3 = 3 then
             begin
               Halt(1); { Halt right here! }
             end;
         end;
     end;
   Canvas.TextOut(10, 10, 'This will not be executed');
 end;
// EndCode
// EndExample: SystemHalt
end.
