Terrapin Resources

Terrapin Logo 4 has been discontinued! Our new Terrapin Logo version is much more powerful and modern; we strongly recommend that you update to our latest release of the Logo programming language.

Debugging

Track program execution.

Debugging commands are essential to find programming errors. They help with inspecting programs and data, to pause a program, to find out why a program takes too much time, and much more. Logo can pause because of several reasons:

  • The PAUSE command has been executed
  • A runtime error has been hit
  • The PAUSE icon has been clicked, or the F4 key has been pressed

The debugging icons in the Toolbar have the following meaning:

Icon Key Command Explanation
F3 TOPLEVEL Halts a program and returns to toplevel.
F4 PAUSE Pauses a program and enters Pause mode.

BACKTRACE

Also: BT

Prints a backtrace.

Syntax

Description

The BACKTRACE command is only available during a PAUSE. It prints to the current chain of the active procedures, FOR and REPEAT loops, run lists etc. See also CONTINUE.

CONTINUE

Also: CO

Ends a pause.

Syntax

Description

CONTINUE ends a pause. A Logo program can pause because is it is stepped (see STEP), because a breakpoint has been hit, or the PAUSE command has been executed, or if Logo has hit a runtime error.

NOTE: The abbreviation CO is usually an abbreviation for the ALL command. Only during a pause, CO is redefined to CONTINUE.

EXECTIME

Outputs the number of microseconds spent inside a procedure.

Syntax

Description

EXECTIME outputs a timer value in microseconds. This timer is local to a procedure and starts once the procedure is invoked. EXECTIME is handy to measure execution times of a procedure.

Example

TO TESTTIMER PR EXECTIME WAIT 1234 PR EXECTIME END

TESTTIMER </span>

PAUSE

Pauses a procedure.

Syntax

Description

PAUSE temporarily halts the execution of a procedure. PAUSE makes it possible to check variables or change the environment during the execution of a procedure. Using the PAUSE command is equivalent to setting a breakpoint in the editor window. When Logo pauses, the editor windows are set to read-only, because the procedure environment is “frozen”. Command like TO or DEFINE are also disabled when Logo pauses. To resume execution of the procedure, press the GO button or type CO or CONTINUE. To return to toplevel, press the STOP button or type TOPLEVEL. PAUSE may only be used within a procedure.

Example

TO SQUAREDRAW FORWARD 60 RT 90 PAUSE REPEAT 3 [FD 60 RT 90] END

SQUAREDRAW </span>