TO is the first word of a procedure definition. When typed at toplevel. TO allows you to write a new procedure without entering the editor. When you type TO and a procedure name, the ? prompt will change to a special prompt, >, to let you know you are no longer at toplevel. This special prompt is stored in the system variable :TO and can be changed.
Type in the procedure. Before you press the Enter key after each line, check for typing errors. Unlike the screen editor, where you can move the cursor through the entire procedure to make corrections, TO allows only line editing commands. Once the Enter key has been pressed, no changes can be made in that line before defining the procedure.
Type END on a separate line and press the Enter key to inform Logo that your procedure is ready to be defined. Once the procedure has been defined, you can use it in the same way as a procedure defined in the editor. The procedure can be executed at toplevel or brought into the editor for further changes.
In the editor, TO procedurename and END are also necessary to indicate to Logo the beginning and end of a procedure.
? TO SAY.HELLO :NAME
> (PRINT "HELLO :NAME)
? SAY.HELLO "BILL