Trace

From Br Wiki
Jump to: navigation, search

The Trace (T) statement displays the line number of each statement in a program as it is being executed.

Comments and Examples

For debugging purposes, it is often helpful to have information about which lines are being executed and in which order. At a point where trouble is anticipated in a program, the programmer can insert the statement

01230 TRACE ON

To start the display of line numbers. Later, the following statement can cancel this feature:

01400 TRACE OFF

The TRACE display runs swiftly and is quickly lost from the screen. The following example will send TRACE output to the printer:

01240 TRACE PRINT

Syntax

TRACE [{ON|OFF|PRINT}]

Trace.png

Default

1.) ON.

Parameters

"ON" initiates TRACE mode; it starts a display of line numbers on the screen.

"OFF" cancels the display of line numbers.

"PRINT" directs TRACE output to the printer.

Technical Considerations

1.) Trace mode may also be initiated, terminated, and directed to the printer with options on the run command and the go command.
RUN TRACE

Additional

To redirect the output to a file you can use a command similar to:

run trace print >trace.txt

Unfortuantely this can not currently be done with the go command.