Logo

Programming-Idioms

History of Idiom 123 > diff from v5 to v6

Edit summary for version 6 by :
[Pascal] Emphasize in comment

Version 5

2016-03-10, 22:35:39

Version 6

2016-03-14, 11:00:23

Idiom #123 Assert condition

Verify that predicate isConsistent returns true, otherwise report assertion violation.
Explain if the assertion is executed even in production environment or not.

Idiom #123 Assert condition

Verify that predicate isConsistent returns true, otherwise report assertion violation.
Explain if the assertion is executed even in production environment or not.

Code
{$ASSERTIONS ON}
Assert(isConsistent,'isConsistent assertion failed.');
Code
{$ASSERTIONS ON}
Assert(isConsistent,'isConsistent assertion failed.');
Comments bubble
Assert() will raise an EAssertionFailed exception if the condition is False.

If you leave out the {$ASSERTIONS ON} (e.g. in production code), the Assert() statement will not be compiled into the program.
Comments bubble
Assert() will raise an EAssertionFailed exception if the condition is False.

If you leave out the {$ASSERTIONS ON} (e.g. in production code), the Assert() statement will not be compiled into the program.