home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
pascal
/
pascsrc.arc
/
LOOPDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-15
|
809b
|
34 lines
(* Chapter 4 - Program 1 *)
program Demonstrate_Loops;
var Count : integer;
Start : integer;
Ending : integer;
Total : integer;
Alphabet : char;
begin
Start := 1;
Ending := 7;
for Count := Start to Ending do (* Example 1 *)
Writeln('This is a count loop and we are in pass',Count:4);
Total := 0;
for Count := 1 to 10 do begin (* Example 2 *)
Total := Total + 12;
Write('Count =',Count:3,' Total =',Total:5);
Writeln;
end;
Writeln;
Write('The alphabet is ');
for Alphabet := 'A' to 'Z' do (* Example 3 *)
Write(Alphabet);
Writeln;
for Count := 7 downto 2 do (* Example 4 *)
Writeln('Decrementing loop ',Count:3);
end.