IT lexicon › Programming › Assertion

Assertion

Programming På svenska → Updated: 2026-05-23

A statement in code about what must be true — if it isn't, the program crashes.

assert balance >= 0. Two uses: in code (catch "can't happen" bugs) and in tests (expect(x).toBe(2)). Different from error handling: assertions should never fail in correctly running code.

← Back to the lexicon