SystemInc (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires two buttons and two text fields. The text fields can be set to any integer and long integer value. Click the buttons to execute Inc.

Code

procedure TForm1.Button1Click(Sender: TObject);
var
  IntVar: Integer;
begin
  IntVar := StrToInt(Edit1.Text);
  Inc(IntVar);
  Edit1.Text := IntToStr(IntVar);		{ IntVar := IntVar + 1 }
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  LongintVar: Longint;
begin
  LongintVar := StrToInt(Edit2.Text);
  Inc(LongintVar, 5);
  Edit2.Text := IntToStr(LongintVar);	{ LongintVar := LongintVar + 5 }
end;

Uses