Demonstrates how to use WHILE loop in Delphi
Simple Borland Delphi tutorial demonstrate how to do WHILE LOOP. Simple form button click event run the WHILE LOOP.
Bookmark:
Demonstrates how to use WHILE loop in Delphi
This example demonstrates how to use WHILE loop in Delphi.
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 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 Delphi Tutorials.
Download materials for this article (Delphi - Tutorials)
While-Loop.zip
File size: 4 KB, File type: zip
Total downloads: 419, Upload date: February 02 - 2009
Ayan Chattopadhyay :: May 29-2009 :: 01:03 PM
I have to work on delphi 7.so it ll be very much helpfull if a get something usefull out of it.Â