Delphi Tutorial


Download this example

               This example is same as previous one. Only different is it uses REPEAT-UNTIL loop instead of FOR loop.

 

          Click RUN button to execute the REPEAT-UNTIL 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 Repeat - Until loop to add numbers to memo }
                     Repeat
                         Memo1.Lines.Add(IntToStr(Count));
                        { Increase the count variable 1 by 1 }
                         Inc(Count);
                     Until Count>N2
                end;

 

 

DOWNLOAD this example

Click here to download this complete example for Delphi 6. (File size 4 KB)

 

Go top


 

Previous Page First Page Next Page

 

 
Copyright © 2002 digitalcoding.com. All rights reserved.