The next command is like the continue statement in C; it starts the next iteration of an enclosing loop. The optional expression argument may evaluate to a positive integer number that indicates which level of the nested loops should be restarted. If omitted, it defaults to 1, i.e. the innermost loop.
Using this command outside a loop causes an immediate run-time error.