Next                                                                                                        Statement

 

NEXT

 

Description

To end a FOR statement, which is a set of statements that are repeated a number of times based on the FOR parameters. The NEXT statement causes the FOR control variable to be incremented by the step increment and tested to see if the repeated statements should be executed again or termination should occur. When termination occurs, the statement following the NEXT statement is executed. FOR/NEXT loops may be nested to any level.

 

Example

Dim weight(5, 10 , 3)

For i=1 to 5

  For j=1 to 10

    For k=1 to 3

      Total=total + weight(i, j, k)

    Next

  Next

Next