For AI agents: Documentation index at /llms.txt

Skip to content

Assertions

An assertion checks a condition at runtime and traps if it fails.

let n = 10;
assert n % 2 == 1; // Traps
let n = 10;
assert n % 2 == 0; // Succeeds

Assertions help catch logic errors early, but should not be used for regular error handling.