Q : What is the syntax for the new for loop released in 1.4.0
A : There are two types of for loops. The declaration for loops
are loop on an entire statement. For example:
|
// ...
|
|
ASSIGN
|
|
for
(j = 1; j <= N; j = j + 1) {
|
|
next
(y[j]) :=
|
|
case
|
|
j = i & cond
: u;
|
|
1
: y[j];
|
|
esac;
|
|
}
|
|
// ...
|
The construction for loops are loop on boolean expressions.
The construction for loop statement start with the connector operation.
There are 3 possible connection operation: &, |, and +.
For example:
|
// ...
|
|
DEFINE
|
|
cond := X | &
for
(j = 1; j <= N; j = j + 1) {
|
|
j = i | y[j] = 0 | y[i] < y[j]
|
|
} -> Z
|
|
// ...
|
|