Debugging macro that halts program execution if an expression is evaluated to 0.
Syntax
Usage
Assert( expression )
Parameters
expression
Any valid expression. If expression evaluates to 0, execution is halted.
Description
The Assert macro is intended for use in debugging and works only if the -g option is selected in the FBC command line. In this case it stops the program execution if expression evaluates to 0.
Its normal use is to check the correct value of the variables during debugging.
If -g is not passed to fbc, the macro does not generate any code.
Example
Sub foo
Dim a As Integer
a=0
Assert(a=1)
End Sub
foo
'' If -g is used this code stops with: test.bas(3): assertion failed at FOO: a=1
Dialect Differences
- Not available in the -lang qb dialect unless referenced with the alias __ASSERT.
Differences from QB
See also