![]() |
Decisions, decisions...Our programs so far have broken down into a list of steps, one after the other. Sometimes, however, we need to make decisions and choose between two or more options. Pascal uses the keywords IF, THEN and ELSE when making choices. Example 12This is a simple program that reads in a person's age and prints out a message.
|
PROGRAM voting; {to decide if you can vote or not} VAR
BEGIN
|
Note that only one of the two messages is displayed, depending on the person's age.
|
© 1998 John Brewer |