Debugging
BlitzMax provides several commands to help with debugging your programs.
The RuntimeError statement can be used to generate a simple runtime error. RuntimeError takes one argument - a string expression describing the error.
The Assert statement allows you to check that an expression is true and, if not, generate a RuntimeError. The syntax for Assert is:
Assert Expression Else StringExpression
If Expression evaluates to false, then a runtime error with StringExpression is generated.
This can be very useful for verifying such things as function parameters. For example:
Function SetAlpha( alpha# )
Assert alpha>=0 And alpha<=1 Else "Alpha value out of range"
'rest of function here...
End Function
Note that Assert only has any effect when building the debug version of your program. The entire statement will be ignored when building the release version.