TAL Programmer's Guide
12 Controlling Program Flow
096254 Tandem Computers Incorporated 12–1
Conditional statements let you provide a choice of paths in your program. These
statements contain a condition, which lets the program select which path to take
during execution.
Some statements can also be executed repeatedly, applying a set of operations to
different data during each iteration. A group of statements that can be executed
repeatedly is called a loop. Each loop must contain a termination condition, which lets
the program decide whether to continue repeating the loop or to stop after a particular
iteration.
Other statements provide unconditional control over program flow. They contain no
decision-making conditions but often follow, or are nested in, a conditional statement.
This section discusses conditional and unconditional control statements in the order
shown in Table 12-1.
Table 12-1. Program Control Statements
Statement Type Operation
IF Conditional Conditionally selects one of two possible statements
CASE Conditional Selects a set of statements based on a selector value
WHILE Conditional Executes a pretest loop while a condition is true
DO Conditional Executes a posttest loop until a condition is true
FOR Conditional Executes a pretest loop n times
ASSERT Conditional Conditionally calls an error-handling procedure
CALL Unconditional Calls a procedure or subprocedure
RETURN Unconditional Returns from a procedure or subprocedure to the caller; returns a
value from a function. As of the D20 release, it can also return a
condition code value.
GOTO Unconditional Branches to a label within a procedure or subprocedure