home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
m
/
mod2tutr.zip
/
EXAMPLES.ZIP
/
CASEDEMO.MOD
< prev
next >
Wrap
Text File
|
1989-01-18
|
2KB
|
61 lines
(* Chapter 4 - Program 6 *)
MODULE CaseDemo;
FROM InOut IMPORT WriteString, WriteInt, WriteLn;
VAR Dummy : INTEGER;
BEGIN
FOR Dummy := 1 TO 25 DO
WriteInt(Dummy,4);
WriteString(" ");
CASE Dummy OF
1..5 : WriteString("the number is small"); |
6..9 : WriteString("it is a little bigger"); |
10,11 : WriteString("it is 10 or 11"); |
14..17 : WriteString("it is midrange"); |
18,20,22,24 : WriteString("it is big and even"); |
19,21,23 : WriteString("it is big and odd");
ELSE
WriteString("The number didn't make the list");
END; (* of CASE *)
WriteLn;
END; (* of FOR loop *)
END CaseDemo.
(* Result of execution
1 the number is small
2 the number is small
3 the number is small
4 the number is small
5 the number is small
6 it is a little bigger
7 it is a little bigger
8 it is a little bigger
9 it is a ;ittle bigger
10 it is 10 or 11
11 it is 10 or 11
12 The number didn't make the list
13 The number didn't make the list
14 it is midrange
15 it is midrange
16 it is midrange
17 it is midrange
18 it is big and even
19 it is big and odd
20 it is big and even
21 it is big and odd
22 it is big and even
23 it is big and odd
24 it is big and even
25 The number didn't make the list
*)