Commissioning Manual
01/2017
307
For loop
for (initialization; test; continuation) instruction(s)
<FOR>
<INIT>…</INIT>
<CONDITION>…</CONDITION>
<INCREMENT>…</INCREMENT>
Instructions
…
</FOR>
The For loop is executed as follows:
1. Evaluation of the expression
(INIT).
2. Evaluation of the expression
(CONDITION) as a Boolean expression.
If the value is false, the For loop is exited.
3. Execution of the following instructions.
4. Evaluation of the expression
(INCREMENT).
5. Continue with 2.
All the variables within the INIT, CONDITION, and INCREMENT branches are declared
and initialized outside the FOR loop.
<LET name = "count">0</LET>
<FOR>
<INIT>
<OP> count = 0</OP>
</INIT>
<CONDITION> count <= 7 </CONDITION>
<INCREMENT>
<OP> count = count + 1 </OP>
</INCREMENT>
<OP> "plc/qb10" = 1+ count </OP>