home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASSRC.ZIP / LOOPIF.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  1KB  |  37 lines

  1.                                 (* Chapter 4 - Program 3 *)
  2. program Loops_And_Ifs;
  3.  
  4. var Count,Index : integer;
  5.  
  6. begin (* Main program *)
  7.    for Count := 1 to 10 do begin (* Main loop *)
  8.       if Count < 6 then
  9.          Writeln('The loop counter is up to ',Count:4);
  10.       if Count = 8 then begin
  11.          for Index := 8 to 12 do begin (* Internal loop *)
  12.             Write('The internal loop index is ',Index:4);
  13.             Write(' and the main count is ',Count:4);
  14.             Writeln;
  15.          end; (* Internal loop *)
  16.       end; (* if Count = 8 condition *)
  17.    end; (* Main loop *)
  18. end.  (* Main program *)
  19.  
  20.  
  21.  
  22.  
  23. { Result of execution
  24.  
  25. The loop counter is up to    1
  26. The loop counter is up to    2
  27. The loop counter is up to    3
  28. The loop counter is up to    4
  29. The loop counter is up to    5
  30. The internal loop index is    8 and the main count is    8
  31. The internal loop index is    9 and the main count is    8
  32. The internal loop index is   10 and the main count is    8
  33. The internal loop index is   11 and the main count is    8
  34. The internal loop index is   12 and the main count is    8
  35.  
  36. }
  37.