The for statement indicates that a statement sequence is to be repeatedly executed while a progression of values is assigned to a variable. This variable is called the control variable of the for statement. It cannot be a component of a structured variable, it cannot be imported, nor can it be a parameter. Its value should not be changed by the statement sequence.
ForStatement = FOR ident ": =" expression TO expression [BY ConstExpression] DO StatementSequence END.
The for statement
FOR v:= A TO B BY C DO SS END
expresses repeated execution of the statement sequence SS with v successively assuming the values A, A + C, A + 2C, ... , A + nC, where A + nC is the last term not exceeding B. v is called the control variable, A the starting value, B the limit, and C the increment A and B must be compatible with v; C must be a constant of type INTEGER or CARDINAL. If no increment is specified, it is assumed to be 1.
FOR i : = 1 TO 80 DO j : = j + a[i] END FOR i := 80 TO 2 BY -1 DO a[i]:= a[i-1] END