Contents | Prev | Next

10.2.6 Assignment compatibility with "for"

The initial value and the final value in a for statement shall be assignment compatible with the type of the control variable, if the statement contained in the for statement is executed.

For example given:

   for i := low to high do writeln(i);

then

   low (the initial value)

and

   high (the final value)

shall be assignment compatible with the type of

   i (the control variable)

if

   writeln(i) (the statement in the for statement)

is executed. NOTE: writeln(i) will get executed unless low is greater than high.

Contents | Prev | Next