Skip to main content

Case Statement

The main method for making decisions in Pascal is to use the if statement. The if statement is a very powerful command but there are certain instances when its power is not required. An alternative is to use the case statement.

The case statement takes the following form:

 
Case (CaseVariable) Of
Value1 : Statements
Value2 : Statements
Value3 : Statements

Else
Statements

EndCase
 

Next: Programming Example: Specification