Description
The assert procedure is based on the C language macro of the same name. The assert procedure can be enabled/disabled using a compiler option.
When enabled the assert procedure evaluates its parameter, which must be a boolean expression. If the expression evaluates to false then the program is terminated. If the expression evaluates to true then the procedure does nothing.
When disabled the assert procedure does nothing.
The idea behind the assert procedure is that you use it during debugging to test the values in your program, and after your program is debugged you don't have to search your program and remove all the calls to this procedure, instead you just disable it using a compiler option.
You should use the assert procedure only to test conditions that must be true if your program has no bugs. A common mistake is using the assert procedure to test normal error conditions that may happen even if your program is bug-free (such as out of memory conditions or invalid user input). For normal error conditions it is better to check for these in some other way and handle then in a more graceful way.
Parameters
The assert procedure's only parameter is an expression of boolean type.
Portability
Operating Systems: All
Standard Pascal: No