Specifications
App - 5
Explanation
For the argument step, positive values and negative values can be designated.
Depending on the designated value in the argument step, the execution of loop is
controlled as follows:
Set value Execution condition
Positive value or 0 counter<=end
Negative value counter<=end
After the execution of program moves to the loop, a series of statements inside the loop
are all executed, and then the value of the argument step will be added to the argumen
t
counter.
At this point, if the completion condition is not satisfied, the statement inside the loop is
executed again. In other cases, the control leaves the loop, and moves to the next
statement of the Next statement.
The Exit For statement can be used only inside the control structure For Each...Next o
r
For...Next, and can complete For...Next in conditions other than the designated numbe
r
of times.
The Exit For statement can be designated repeatedly in any place inside For Each...Next
or For...Next.
The Exit For is often used with the assessment of conditions (such as If...Then), and
passes the control to the statement right after Next.
The For...Next loop can be made into a nested structure.
In other words, a For...Next loop can be inside another For...Next loop.
When making the loop nested, designate different variable names for each argumen
t
counter.
The following shows an example of correct statement.
For I = 1 To 10
For J = 1 To 10
For K = 1 To 10
. . .
Next K
Next J
Next I
Caution
If the argument counter of the Next statement is skipped, the argument counter continues
execution as if it is designated.
If the Next statement is located before the corresponding For statement, an error will
occur.