|
This example demonstrates how to use FOR loop.

Download this example
In
this example by click on RUN button will execute the FOR loop.
procedure TForm1.Button2Click(Sender: TObject);
Var
V1, V2 : Variant;
N1, N2, Count : Integer;
begin
{ Clear the memo before adding numbers }
Memo1.Lines.Clear;
V1:=Edit1.Text;
V2:=Edit2.Text;
{ Convert variant to integers }
N1:=Integer(V1);
N2:=Integer(V2);
{ Use FOR loop to add numbers to memo }
For Count:=N1 to N2 Do
Memo1.Lines.Add(IntToStr(Count));
end;
DOWNLOAD this example
Click
here to download this complete example for Delphi 6. (File
size 4 KB)

|