TAL Reference Manual
Statements
TAL Reference Manual—526371-001
12-3
ASSERT Statement
2. This example shows a compound statement
BEGIN
a := b + c;
d := %B101;
f := d - e;
END;
ASSERT Statement
The ASSERT statement conditionally invokes the procedure specified in an
ASSERTION directive.
assert-level
is an integer in the range 0 through 32,767. If assert-level is equal to or higher than
the
assertion-level specified in the current ASSERTION directive and if condition is
true, the procedure specified in the ASSERTION directive executes. If the
assert-
level is lower than the assertion-level, the procedure is not activated.
condition
is an expression that tests a program condition and yields a true or false result.
Usage Considerations
The ASSERT statement is a debugging or error-handling tool. You use it with the
ASSERTION directive as follows:
1. Place an ASSERTION directive in the source code where you want to start
debugging. In the directive, specify an
assertion-level and an error-handling
procedure such as the D-series PROCESS_DEBUG_ procedure or the C-series
Debug procedure:
?ASSERTION 5, PROCESS_DEBUG_ !Assertion-level is 5
2. Place an ASSERT statement at places where you want to invoke the error-
handling procedure when an error occurs. In the statement, specify an
assert-level
that is equal to or higher than the
assertion-level and specify an expression that
tests a condition. For example, the standard function $CARRY returns true if the
carry indicator is on and false if it is off:
ASSERT 10 : $CARRY; !Assert-level is 10
ASSERT
assert-level : condition
VST1202.vsd