Equinox Online Help - Language Reference - A to Z

Home

Assert

Applies to
SyntaxAssert Expression
Action[Statement] Debugging support.
ScopeUsable anywhere.
Notes

The assert statement displays an "Assertion Failed" error message if Expression is false. Expression normally takes the form of a condition you are testing for in the software which may be the cause of an error in your method.

You can put Assert statements throughout your methods and control whether they are compiled into the code via the Warning tab in the Systems Settings dialog. If you select a warning level of 7 or 8, Assert statements will be compiled into the code. If however a warning level of less than 7 is selected the Assert statements are ignored when the method is compiled. In addition, if a warning level of less than 7 is selected when the method is executed, any assertion failures are also ignored.

CategoryDebugging
See Also Print, PrintDevice, ReportError, Stop
Example

The first example will display an "Assertion Failed" error if the AvPrice workarea is greater than 1000.

Assert AvPrice > 1000

The next example will display a warning if the string does not start with a number or if it is less than 7 characters long.

Assert TString[1] >> "0123456789" And Len(TString) >= 7

This example ensures that assertions are active

| At start event
Assert False