Control flow¶
Use mo.stop
to halt execution of a cell, and optionally output an object.
This function is useful for validating user input.
marimo.stop
¶
Stops execution of a cell when predicate
is True
When predicate
is True
, this function raises a MarimoStopError
. If
uncaught, this exception stops execution of the current cell and makes
output
its output. Any descendants of this cell that were previously
scheduled to run will not be run, and their defs will be removed from
program memory.
Example:
Raises:
When predicate
is True
, raises a MarimoStopError
.
Use mo.ui.refresh
to trigger other cells to run periodically, on a configurable
interval (or on click).