|
This example is same as previous one. Only different is it uses
WHILE loop instead of FOR loop.
Download this example
In
this example by click on RUN button will execute the WHILE 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);
{
Set Count to a starting No. }
Count:=N1;
{ Use While loop to add numbers to memo }
While Count<=N2 Do
Begin
Memo1.Lines.Add(IntToStr(Count));
{ Increase the count variable 1 by 1 }
Inc(Count);
End;
end;
DOWNLOAD this example
Click
here
to download this complete example for Delphi 6. (File size 4 KB)

|