◄Example► ◄Contents► ◄Index► ◄Back► ────────────────────────────────────────────────────────────────────────────── 'This example uses EXIT statements to exit a variety of control-flow 'structures. A loop is continuously executed until you press any key. 'Once a key is pressed, the next EXIT statement that executes will cause 'the program to end. DECLARE SUB ExitDemo () CLS DO PRINT : PRINT "Entering/Reentering ExitDemo" ExitDemo SLEEP 1 LOOP WHILE INKEY$ = "" PRINT "Exiting 'EXIT' example program" SUB ExitDemo DO FOR I% = 1 TO 1000 Num% = INT(RND * 100) SELECT CASE Num% CASE 7 PRINT "Exiting For...Next Loop in ExitDemo SUB" EXIT FOR CASE 29 PRINT "Exiting Do...Loop in ExitDemo SUB" EXIT DO CASE 54 PRINT "Exiting ExitDemo SUB" EXIT SUB CASE ELSE END SELECT NEXT I% LOOP END SUB