WWW.NNC.IR
Macro Reference
526
Vision System FH/FZ5 Series
User’s Manual (Z340)
For To Step Next
Repeats the statements between the For and Next statements.
Format
For <variable> = <startValue> To <endValue>[ Step <increment>]
<statement>
Next[ <variable>]
Parameter
Return value
None.
Description
Repeats the specified For block statement in the <statement> parameter until the loop counter variable
specified in the <variable> parameter reaches the <endValue> parameter value. The loop counter value
starts from the <startValue> parameter value. Every repeating process increments the loop counter value by
the <increment> parameter value.
If the <increment> parameter is omitted, the every repeating process increments the loop counter variable
value by one.
If the Exit For statement is used in the For block statement, the statement force stops the repeating operation
immediately.
If the program process is jumped into or out of the For block statement using the Goto or Gosub function, the
resulting operation may be unpredictable.
If neither the For statement nor the Next statement is used, either the "NEXT without FOR", "FOR without
NEXT", or "EXIT without FOR" error will occur depending on the statement that is used.
If the Next statement is not followed by the For statement, the "NEXT without FOR" error will occur.
If the format is written incorrectly, such as writing the macro function name incorrectly, omitting a comma, or
omitting a half-width space, a "Syntax error" error will occur.
Usage Cautions
• None.
Parameter
name
Data type Description
<variable> Integer type Loop counter variable of repetition process
<startValue>
Integer type Initial value of loop counter variable
<endValue>
Integer type Loop counter variable value that end up repetition process
<increment>
Integer type Increment of the loop counter variable
<statement>
Integer type Statement to be executed repeatedly