Logo

Programming-Idioms

History of Idiom 123 > diff from v27 to v28

Edit summary for version 28 by hamgom95:
[Lua] Add infos about production assert

Version 27

2020-10-24, 14:05:23

Version 28

2020-12-02, 09:50:49

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.

Variables
isConsistent
Variables
isConsistent
Code
assert(isConsistent() , "Assertion violation") 
Code
assert(isConsistent() , "Assertion violation") 
Comments bubble
Cannot be ignored in production environment. One can overwrite the global assert function with an noop, but the evaluation and function call costs remain.