Quick start manual
Syntactic elements
4-21
Declarations and statements
ƒ {code to execute if no answer is found }
Exit;
FoundAnAnswer:
ƒ { code to execute when an answer is found }
end;
Notice that we are using goto to jump out of a nested loop. Never jump into a loop or
other structured statement, since this can have unpredictable effects.
Structured statements
Structured statements are built from other statements. Use a structured statement
when you want to execute other statements sequentially, conditionally, or
repeatedly.
• A compound or with statement simply executes a sequence of constituent
statements.
• A conditional statement—that is, an if or case statement—executes at most one of
its constituents, depending on specified criteria.
• Loop statements—including repeat, while, and for loops—execute a sequence of
constituent statements repeatedly.
• A special group of statements—including raise, try...except, and try...finally
constructions—create and handle exceptions. For information about exception
generation and handling, see “Exceptions” on page 7-27.
Compound statements
A compound statement is a sequence of other (simple or structured) statements to be
executed in the order in which they are written. The compound statement is
bracketed by the reserved words begin and end, and its constituent statements are
separated by semicolons. For example:
begin
Z := X;
X := Y;
Y := Z;
end;
The last semicolon before end is optional. So we could have written this as
begin
Z := X;
X := Y;
Y := Z
end;