typst::foundations

Function assert

source
pub fn assert(
    condition: bool,
    message: Option<EcoString>,
) -> StrResult<NoneValue>
Expand description

Ensures that a condition is fulfilled.

Fails with an error if the condition is not fulfilled. Does not produce any output in the document.

If you wish to test equality between two values, see assert.eq and assert.ne.

ยงExample

#assert(1 < 2, message: "math broke")