CATCH
Syntax CATCH word instructionlist
CATCH "TRUE instructionlist
CATCH "ERROR instructionlist

 
Explanation CATCH runs the instructions in its second input when Logo encounters a THROW statement with the same word argument.

There are two special uses of CATCH. If the first input to CATCH is TRUE, any THROW statement will be caught. Also, CATCH "ERROR catches an error that would otherwise print a Logo message and return to toplevel. In this case, the built-in variable ERROR contains a hint about which error occured, and the built-in variable ERRORTEXT contains the error message that Logo would have printed.
 

Examples TO NAMIT 
     CATCH "NOTNAME [NAMIT1] 
     NAMIT 
END
NAMIT defined
TO NAMIT1 
     PRINT [PLEASE TYPE A NAME] 
     MAKE "NAME READ 
     IF NUMBER? :NAME [PRINT [THAT'S A NUMBER, NOT A NAME] THROW "NOTNAME] 
     PRINT (SE :NAME [IS A GOOD NAME])
END
NAMIT1 defined
NAMIT 
PLEASE TYPE A NAME 
KURT 
KURT IS A GOOD NAME 
PLEASE TYPE A NAME 

THAT'S A NUMBER NOT A NAME 

TopIndex