home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / modula2 / tutorial / programs / loopif.mod < prev    next >
Text File  |  1993-03-14  |  667b  |  27 lines

  1.                                          (* Chapter 4 - Program 3 *)
  2. MODULE LoopIf;
  3.  
  4. FROM InOut IMPORT WriteString, WriteInt, WriteLn;
  5.  
  6. VAR Index, Count, Dog : INTEGER;
  7.  
  8. BEGIN
  9.    FOR Index := 1 TO 10 DO
  10.       WriteString("Major loop");
  11.       WriteInt(Index,3);
  12.       IF Index < 7 THEN
  13.          FOR Count := 15 TO (15 + Index) DO
  14.             WriteString(' XXX');
  15.          END;
  16.          WriteLn;
  17.       ELSE
  18.          WriteString(' How many dogs?');
  19.          FOR Dog := 1 TO 10 - Index DO
  20.             WriteString("  too many");
  21.          END;
  22.          WriteLn;
  23.       END;  (* ELSE part of IF statement *)
  24.  
  25.    END (* Major FOR loop *)
  26. END LoopIf.
  27.