next


Parameters

None

_result

Not set.

Descriptions

The next statement is part of an while statement. When a next statement is executed, it skips the remainder of the instructions in a while loop's code block. The loop is then restarted by returning to the while line for reevaluation of its expression. It is an error to use a next statement outside of a while loop. In other programming languages this is often called a "continue" statement.

In the example below the names of a robot's team members are printed. The next statement is used to skip printing of the robot's own name. This example is actually strange since it would be cleaner to place the print command itself inside the if statement and check for inequality. In practice the next statement is not often required, but is occasionally handy in large while loops.

idx = 0
while( idx < _teammemberstotal )
    if( _teammemberstotal[idx] == _name )
        idx = idx + 1
        next
    endif

    print( _teammemberstotal[idx] )
    idx = idx + 1
endw

See Also

while, endw, endwhile, break, if