BlitzMax provides several commands to help with debugging your programs:
- DebugStop - In debug mode, causes the program to stop executing and activates the debugger. In release mode, no effect.
- DebugLog StringExpression - In debug mode, causes StringExpression to be printed to the debugger output window. In release mode, no effect.
- Assert Expression Else StringExpression - In debug mode, causes a RuntimeError if Expression evaluates to false. No effect in release mode.
Assert is particularly useful for validating function arguments. For example:
Function SetAlpha( alpha# ) Assert alpha>=0 And alpha<=1 Else "Alpha value out of range" 'rest of function here... End Function
However, since asserts are taken out in release mode, be careful that your asserts don't have any 'side effects' - code that may affect the execution of the program.