FOR_LOOP_VAR_MODIFIED¶
Severity: warn.
PLCopen: L12 — a FOR loop counter shall not be modified inside the loop body.
The loop counter is assigned to inside the loop body. Per IEC 61131-3 and PLCopen, doing this is undefined — implementations may honour the new value, ignore it, or loop unexpectedly long. Either way the loop's intent is gone.
Settings. No check-specific config.
Trigger.
The bot posts.
Fix. Use a WHILE loop if the iteration count is genuinely dynamic. If you just wanted a different step, use the BY clause of the FOR (FOR i := 1 TO 10 BY 2 DO).