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

  1.                                          (* Chapter 4 - Program 6 *)
  2. MODULE CaseDemo;
  3.  
  4. FROM InOut IMPORT WriteString, WriteInt, WriteLn;
  5.  
  6. VAR Dummy : INTEGER;
  7.  
  8. BEGIN
  9.  
  10.    FOR Dummy := 1 TO 25 DO
  11.       WriteInt(Dummy,4);
  12.       WriteString("  ");
  13.       CASE Dummy OF
  14.          1..5        : WriteString("the number is small"); |
  15.          6..9        : WriteString("it is a little bigger"); |
  16.          10,11       : WriteString("it is 10 or 11"); |
  17.          14..17      : WriteString("it is midrange"); |
  18.          18,20,22,24 : WriteString("it is big and even"); |
  19.          19,21,23    : WriteString("it is big and odd");
  20.       ELSE
  21.          WriteString("The number didn't make the list");
  22.       END;  (* of CASE *)
  23.       WriteLn;
  24.    END;  (* of FOR loop *)
  25.  
  26. END CaseDemo.
  27.