assert

Environment

Assert that a condition is true. Throws an error if false.

Syntax

assert(condition)
assert(condition, msg)

Examples

assert(x > 0, 'x must be positive')
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.