NEXT

NEXT V

ENDS A LOOP "FOR" WHICH USES THE VARIABLE V AS A COUNTER

  • Type: Command
  • Parameter: 1
  • Group: Structures

ACTION

The command NEXT is associated with the command "FOR V=S TO E" to define a group of statements and to use a variable V as a counter.

When NEXT is executed, the counter V is incremented, and then the group of statements between FOR and NEXT is executed again only if V is less than or equal to value in E.

Otherwise, if V is greater than E, the execution jumps to the statement after NEXT.

SYNTAX: NEXT V

  • V : variable used as a counter

USE

  • NEXT is used associated to FOR, to make a "loop", that is a group of statements to be executed a number of times defined by the starting and end values.

ERROR

  • If V is not a correct variable name.

EXAMPLE

dim i

for i=1 to 10

print i

next i

SEE ALSO

FOR

TO

STEP