Xbasic

DEBUG Function

Syntax

N debug(N switch)

Arguments

switchNumeric

Debugger action to take. Can be one of the following values:

Value
Description
-2

Toggle Debugger

-1

Ask if Debugger is on

0

Turn off Debugger

1

Turn on Debugger

Description

Forces the application to break in the Xbasic debugger.

Discussion

The DEBUG() function is used to turn on or off the Alpha Anywhere Debugger. The Debugger is used to trace through an Xbasic script, to watch the flow of execution. You can use the Debugger to find run-time errors and logical errors in your scripts. For more information, see "Finding Errors in Scripts".

Use the On/Off Switch parameter to turn the Debugger on or off. To turn on and display the Debugger window, use debug(1). To close the Debugger window, use debug(0).

Example 

When running this script, the Debugger will appear after the word "Start" is printed to the Trace window.

function process as C (param as N)
    select
        case param = 0
            process = "Zero"
        case param = 1
            process = "One"
        case param = 2
            process = "Two"
        case else
            process = "Error"
    end select
end function

dim result as C
trace.writeln("Start")
debug(1)

x = 0
for x = 1 TO 10
    y = mod(x,3)
    result = process(y)
    trace.writeln(result)
next x
trace.writeln("End")

Limitations

Developer Environment Only

See Also