Statement - Iteration of statement execution.
FOR <index> :=
<minimum> TO <maximum> BY
<step> DO
<statements>
END_FOR;
index = DINT internal variable used as index
minimum = DINT expression: initial value for
index
maximum = DINT expression: maximum allowed value for
index
step = DINT expression: increasing step of index
after each iteration (default is 1)
The "BY <step>" statement can be omitted. The default value for the step is 1.
iArrayDim := 10;
(* resets all items of the array to 0 *)
FOR iPos := 0 TO (iArrayDim - 1) DO
MyArray[iPos] := 0;
END_FOR;
(* set all items with odd index to 1 *)
FOR iPos := 1 TO 9 BY 2 DO
MyArray[ipos] := 1;
END_FOR;
Not available
Not available
Not available