PC Logo Wiki

Sometimes when you run a Logo procedure its outcome is unexcepted and not what you really wanted it to do. The computer is a very literal machine and does exactly what you tell it to do since it does not know what you mean for it to do. Sometimes you may not always say exactly what you mean and in Logo this shows up in procedures that do not do what you want.

These unexpected occurrences are known as bugs and are common in computer programming of all types. Because of the procedural nature of Logo and its ability to break a project into small parts and write a procedure to perform each part, bugs are sometimes easier to find, isolate, and eliminate than in some other computer languages.

Nevertheless, it can sometimes still be difficult to figure out why your Logo programs are not acting as you expected. Logo provides several types of debugging tools to help you eliminate bugs or unexpected consequence from your programs.


A simple means of debugging is to pause while a procedure is executing and examine what it has done so far. The Logo command PAUSE will temporarily halt execution of a procedure and return control to the keyboard without returning to toplevel. By inserting a PAUSE into a procedure, you can suspend the execution of the procedure so you can examine what it has done so far.

A PAUSE in a procedure is indicated by the pause mode prompt:


This indicates that flow control is maintained by the procedure and that you have not returned to toplevel. Logo Will, however, execute any commands typed at the keyboard while in pause mode, allowing you to examine the value of variables, ascertain the position of the turtle(s), etc.

You can also click the Pause button in the button bar or select the Pause command from the Debug Menu any time to temporarily pause a procedure. You can also pause a procedure by pressing Control-Z.

Type CONTINUE or CO to exit pause mode and return flow control to the procedure which will continue executing until another PAUSE, STOP, or END is encountered.

Alternatively, you can click the Continue button in the button bar or select the Continue command from the Debug Menu.

By typing CONTINUE with a number as an argument and putting both in parentheses, the procedure will not pause again until it has encountered PAUSE the number of times indicated by the argument to CONTINUE. This allows you to pass through several steps of a procedure before pausing again which can speed up debugging.

Type TOPLEVEL or press Control-G while in pause mode to return to TOPLEVEL without continuing execution of the procedure.


SINGLE.STEP is a special case of PAUSE. SINGLE.STEP is a predefined Logo name whose value is FALSE when Logo starts. By typing


you automatically insert a PAUSE after every command of every procedure. Logo will execute each command one at a time (a single step) and put you in single step pause mode after each one. Single step pause mode is indicated by the prompt:


As in pause mode, you can type commands at the keyboard. Logo will tell you what it is doing between each single step, indicating what is being evaluated and output.

You can also return single stepping on and off by selecting the Single Step command on the Debug Menu. This command acts like a toggle; Select it will either turn single stepping on or off.


Tracing is following your procedure step by step to see exactly at what point its behavior departs from what you want it to do. TRACE is a pre-defined Logo name whose value is FALSE when Logo starts. By typing


Logo will automatically print information in the Trace window about its internal operations for you to monitor. This information includes what is being evaluated and output as Logo executes each command in a procedure.

The pre-defined name TRACE.LEVEL determines the detail of the information that TRACE provides. :TRACE.LEVEL can be set at level 1, 2, or 3. The level of :TRACE.LEVEL determines the amount of detail Logo reports about its internal operations. The higher the level, the more detail that is reported. When Logo starts, the value of :TRACE.LEVEL is 2.

The Global trace... command in the Debug Menu lets you select directly which trace level you want.


The TRON command is a special type of tracing. TRON accepts a Logo name, the name of a property list, or the name of a procedure as an argument. When TRON is used with a Logo name, the value of that name is displayed in the Names window. Each time the value changes, the new value appears in the Names window. The values of property lists whose name is used as the argument to TRON appear in the Properties window. You can edit the value of the name or property list directly inside the Names or Properties window.

Operation of any procedure being traced by using its name as an argument with the TRON command or by setting :TRACE to "TRUE is reported in the Trace window.

The TROFF command turns off debugging for thespecified name or procedure.

Both TRON and TROFF can be used with no or with multiple inputs if the commands and their inputs are surrounded with parentheses. Using TRON with no inputs enables tracing for all Logo names. TROFF with no inputs completely disables debugging.

The TRON and TROFF command do not interact with the built-in TRACE and TRACE.LEVEL variables. Since TRACE and TRACE.LEVEL operate globally in Logo, TRON and TROFF allow more selective monitoring of your program operation.

Debug Buttons

You can also enable and disable debugging for selected names, property lists, or procedures by clicking one of the following buttons on the button bar:

9 Enable or disable tracing of selected procedures. The Trace procedures button is equivalent to the menu command Debug/Procedures...
10 Enable or disable the display of the contents of selected names. The Trace names button is equivalent to the menu command Debug/Names...
11 Enable or disable the display of the property list of select names. The Trace properties button is equivalent to the menu command Debug/Properties...

Debug Dialog

When you choose to trace procedures, names, or property lists with either the buttons or the menu commands, the Debug Dialog appears. This allows you to select which procedures, names, or property lists you want to trace. All of the available procedures, names, or property lists are listed in the left window of the Debug Dialog. Select the ones you want to trace in the left window and click the button to move it to the right window which lists the procedures, names, or property list from being traced. The reverse process eliminates a procedure, name, or property lists from being traced. When you close the Debug Dialog and run your Logo programs, the appropriate trace window automatically opens, showing the output or value of the procedure(s), name(s), or property list(s) you specified that you wanted to trace.

Debug dialog.