Skip to main content

function

debug_assert

debug_assert[stringable: Stringable](cond: Bool, msg: stringable)

Asserts that the condition is true.

The debug_assert is similar to assert in C++. It is a no-op in release builds unless MOJO_ENABLE_ASSERTIONS is defined.

Right now, users of the mojo-sdk must explicitly specify -D MOJO_ENABLE_ASSERTIONS to enable assertions. It is not sufficient to compile programs with -debug-level full for enabling assertions in the library.

Parameters:

  • stringable (Stringable): The type of the message.

Args:

  • cond (Bool): The bool value to assert.
  • msg (stringable): The message to display on failure.