GLBasic User Manual

Main sections

BREAK

BREAK


The BREAK command instructs the program to break out of a running FOR or WHILE loop. As soon as the BREAK statement is read, program control will pass to the line of code following the NEXT (for a FOR loop) or WEND (for a WHILE loop) statement.

FOR i=0 TO 10 STEP 2
PRINT i, 0, 32*i
    IF i=6 THEN BREAK // 8 and 10 will never print
NEXT

SHOWSCREEN
MOUSEWAIT


Output :
0
2
4
6

See also...