pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Example 146 CALL Statement
PROC p (a, b, c);
INT(32) a;
REAL b;
REAL(64) c;
BEGIN
END;
PROC q;
BEGIN
CALL p(1.0E0, ! ERROR: Cannot pass REAL to INT(32)
1D, ! ERROR: Cannot pass INT(32) to REAL
1F); ! ERROR: Cannot pass FIXED to REAL(64)
END;
CASE
The CASE statement executes a choice of statements based on a selector value. Normally, you use
labeled CASE statements. Labeled CASE statements are described first, followed by unlabeled
CASE statements.
If a case index does not match any alternative, an instruction trap occurs.
Topics:
Empty CASE (page 207)
Labeled CASE (page 207)
Unlabeled CASE (page 209)
Empty CASE
pTAL does not allow empty CASE statements. A CASE statement include at least one alternative,
even if there are no statements specified for that alternative.
Example 147 Empty CASE Statement
CASE i OF
BEGIN ! In this unlabeled CASE statement,
; ! the semicolon creates an alternative
END;
Labeled CASE
The labeled CASE statement executes a choice of statements when the value of the selector matches
a case label associated with those statements.
selector
is an INT or INT (32) value arithmetic expression that uniquely selects the case-alternative
for the program to execute.
CASE 207