Purpose |
Display information in the IDE's Debugger Output Window |
Syntax |
#DEBUG PRINT string_expression |
Remarks |
The PRINT option allows the programmer to display arbitrary information in the IDE's Debug Output Window during a debugging session. The output window is provided by debugger to display status information about the state of the debugging session; however, #DEBUG PRINT provides a convenient way of creating a "process log" of a Sub/Function/Method/Property/Variable as the program runs. Combined with FUNCNAME$, #DEBUG PRINT can be a useful tool for debugging application code. See the Example below. This is possible because the Debugger Output Window has a scrollable range somewhat like a console window, whereas the Watch Window shows only the instantaneous value of a variable. #DEBUG PRINT statements are ignored when code is compiled into a standalone (EXE/DLL) file; they are only included when using the Debugger. Control codes in the string are translated into hex format in the output window. For example, embedded CHR$(0) or $NUL bytes are displayed as "<00>". |
See also |
|
Example |
FUNCTION PBMAIN() AS LONG Arg1% = 10000 Arg2% = 20000 CALL MySub(Arg1%, Arg2%) CALL MySub(Arg2%, Arg1%) #DEBUG PRINT "Done!" END FUNCTION
SUB MySub(Arg1%, Arg2%) #DEBUG PRINT "We're in " & FUNCNAME$ #DEBUG PRINT "Arg2% is" & STR$(Arg2%) END SUB |
Result |
We're in MYSUB Arg2% is 20000 We're in MYSUB Arg2% is 10000 Done! |