DEBUG Statement

The DEBUG statement enters the mvBASIC Debugger at the current line of execution.

Format

DEBUG

Description

The DEBUG statement invokes the interactive mvBASIC Debugger. When this statement is encountered, the execution of the program is stopped and the Debugger is entered.

As expected, the DEBUG statement is particularly useful while debugging a program. The alternative is to try to force a pause in program execution (through a SLEEP or INPUT statement) long enough to hit the BREAK key to enter the Debugger, or to run the program with the D option.

Example

In this application the internal subroutine CALCULATE is executed, and then the value of the variable MONTH is examined. If MONTH contains an unexpected value, an error message is printed and the Debugger is entered.

GOSUB CALCULATE

IF MONTH > 12 OR MONTH < 1 THEN

   PRINT "ERROR IN CALCULATION OF VARIABLE  '

MONTH' "

   DEBUG

END

See Also

Statement and Function Reference