statement |
expression![]() ![]() |
The assignment statement assigns the value of expression
to expression
.
expression
must be an lvalue.
A compile-time error is produced if the type of expression
is not assignment compatible to the type of expression
.
It is not defined which of the expressions is evaluated first (in case the
expressions have side effects).
statement |
expression ; |
The expression statement evaluates expression only for its side effects. The result is not used.
statement |
delete expression ; |
This statement deletes the object referred to by expression. Expression must be of any array type, or null.
statement |
if expression then
statement![]() ![]() |
The if statement evaluates expression.
expression must be of type bool.
If expression evaluates to true,
statement is executed.
If expression evaluates to false and the optional
else part is given, statement
is executed.
The dangling-else ambiguity is resolved by connecting the else with
the last encountered else-less if at the same block nesting
level.
statement |
for expression![]() ![]() ![]() ![]() ![]() |
The for statement repeats statement a specified number of
times.
expression
denotes the loop value, which must be an lvalue;
expression
the begin value;
expression
the end value;
expression
the step size.
If the by part is omitted, the step size is 1.
All expressions must be of type int.
Expressions 2, 3, and 4 are evaluated only once, before statement
is executed.
However, the evaluation order of the expressions is not defined.
If the begin value is greater than the end value and the step size is positive,
or if the begin value is smaller then the end value and the step size is
negative, statement
is not executed at all.
Otherwise, after each iteration of statement
,
expression
is incremented by the step size.
Although considered poor programming practice, it is allowed to use
expression
as lvalue within the for-loop.
statement |
repeat statement![]() |
The repeat statement repeats statement until
expression evaluates to true.
statement
is executed at least once.
expression must be of type bool.
statement |
while expression do
statement![]() |
statement is executed as long as the evaluation of
expression yields true.
expression must be of type bool.
statement |
return [ expression ] ; |
The return statement exits from the current subprogram. If the subprogram is a procedure, expression must be omitted. If the subprogram is a function, expression must be provided and assignment compatible to the return type of the function. The return value will be the result after evaluating expression.
statement |
[ var var_declaration_list ] begin [ statement_list ] end |
statement_list |
statement [
statement_list![]() |
The compound statement is both used for grouping statements, and for introducing local variables. If the optional var_declaration_list is provided, a new scope is introduced starting from the keyword var up to the keyword end.
K.G. Langendoen 2010-01-08