NEXT

NEXT


NE Index Level NOT
Syntax FOR variable = expression TO expression {STEP expression}
 statement{s}
NEXT variable
Category BASIC
Type Statement
Description occurs at the end of a "for..next" construct and causes the iteration counter to increment and branches to the corresponding "for" statement to decide whether to terminate.

The "for..next" construct may also be exited using the "exit" statement.

The "step" statement allows the increments of the loop to be changed. For example, "step 2" increments the variable by 2 when the "next" statement is encountered.

"step" can be a negative number, decrementing the variable at the "next" statement. A "step" of zero does not execute the "for..next" loop.
Options
See Also statements & functions FOR ... NEXT EXIT
Example for i = 1 to 10
crt i:" ":
next i
print

1 2 3 4 5 6 7 8 9 10


numbers = ''
for i = 1 to 2
for j = 1 to 5
  numbers<i,j> = j
next j
next i
print numbers

1]2]3]4]5^1]2]3]4]5

for j = 10 to 1 step -1
print j:" ":
next j
print

10 9 8 7 6 5 4 3 2 1
Warnings
Compatibility D3 7.0 AP R83
NE Index Level NOT