Assertion
Also called: assert
Related terms: invariant, precondition, logging
A check that a condition you expect to be true really is true. For example, assert(maxHealth > 0) makes an invalid setup visible near its cause, before later code divides by maxHealth.
A failed assertion may stop execution, log an error or break into a debugger, depending on the setup. Some builds disable assertions, so do not put required work inside them or rely on them to validate untrusted input.
- Further reading
- Godot: @GlobalScope: assert