A multiple assignment statement has the form
S1 || S2 || ... || Skwhere each
Si
is an assignment
statement — for example:
x[a] := x[b]+1 || x[b] := x[a] || y := x[a]It is executed by first evaluating all the right-hand expressions, then performing the assignments. This example statement sets the new value of
x[a]
to one plus the old value of
x[b]
and the new value of x[b]
to the old
value of x[a]
. It sets the new value of
y
to the old value of x[a]
. The
assignments are performed from left to right, which in the example
matters only if a
equals b
, in which case
the new value of x[a]
(and therefore of
x[b]
) equals its old value.