TOPLEVEL
Syntax TOPLEVEL 
 
Explanation TOPLEVEL stops execution of a procedure and returns Logo to toplevel, the command mode. TOPLEVEL in a procedure performs the same function as clicking the Stop (red stoplight) button. You may also THROW "TOPLEVEL to return to toplevel. TOPLEVEL may also be caught with a CATCH command.

Note that TOPLEVEL is different from STOP in that control is not returned to any calling procedure.
 

Example
(The procedure below can be used as a subprocedure of a game program. If the player wants to end the game, the procedure returns to toplevel.)

TO ENDALL  
    PR [DO YOU WISH TO CONTINUE?]
    PR [PLEASE TYPE YES OR NO] 
    MAKE "ANSWER READLIST 
    IF :ANSWER = [YES] THEN GAME 
    IF :ANSWER = [NO] THEN PR [THAT'S ALL FOR THIS GAME.]
    TOPLEVEL 
END

TopIndex