INC
and DEC
statements have the form:
INC(v, n) DEC(v, n)where
v
designates a variable of an ordinal type and n
is an
optional integer-valued argument. If omitted, n
defaults to 1
.
The statements increment and decrement v
by n
, respectively.
The statements are equivalent to:
WITH x = v DO x := VAL(ORD(x) + n, T) END WITH x = v DO x := VAL(ORD(x) - n, T) ENDwhere
T
is the type of v
and x
stands for a variable that
does not appear in n
. As a consequence, the statements check for range
errors.
In unsafe modules, INC
and DEC
are extended to ADDRESS
.