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 |
|RuntimeError StringExpression||Causes a runtime error exception (see: Exceptions ) to be thrown with the specified string.|
|Assert Expression Else StringExpression||In debug mode, causes a RuntimeError if |
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.