ASSERT procedure

Language reference ›› Built-in procedures ›› "console" procedures ››
Parent Previous Next

assign-procedure = ASSERT "(" conditional { "," message } ")" .

NEW! (V2.0): If <conditional> is FALSE, an error is generated to the ERROR console and the processor is halted.

<message> is an optional message that is added to the output.


if <message> is not specified, the output form is:

 "Assertion failed in xxxx at line nnnn"

else the output contains the message:

 "Assertion failed in xxxx at line nnnn: mmmm"

Where:

 xxxx is the module name,

 nnnn is the source line number in the module,

 mmmm is <message>.


The code is not generated if assertions are disabled.


If there's no assigned ERROR routine, the message cannot be sent but the processor is halted.



 assert(Param <> 0, 'Bad behaviour'); { Parameter cannot be zero }


See also: ASSIGN, $ASSERTIONS