Typst Fumadocs

Assert

Documentation for the `assert` function.

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")
#assert(
  condition,
  message: str
) -> 

Parameters

Prop

Type

Definitions

Ensures that two values are equal.

Fails with an error if the first value is not equal to the second. Does not produce any output in the document.

#assert.eq(10, 10)
#assert.eq(
  left,
  right,
  message: str
) -> 

Parameters

Prop

Type

Ensures that two values are not equal.

Fails with an error if the first value is equal to the second. Does not produce any output in the document.

#assert.ne(3, 4)
#assert.ne(
  left,
  right,
  message: str
) -> 

Parameters

Prop

Type

On this page