Documentation (c) 2006-2008 Hobby-Robotics, LLC


For To Next statement

For Next repeats block of statements based on the counter variable, counter variable is incremented after each execution by adding Step value. Counter variable is assigned Start_expression value on entry into the loop. Block of statements is executed if the counter variable value is less then or equal to the End_expression for positive Step values. For negative Step values the condition is more then or equal.

Loop with default Step 1

For Var = Start_expression To End_expression

...

Next Var

With Step specified

For Var = Start_expression To End_expression Step Expression

...

Next Var

Wikipedia: Count-controlled loops

Wikipedia: For loop