Skip to content

Stopping execution

Use mo.stop to conditionally stop execution of a cell.

Source code for examples/control_flow/stop_execution.py

Tip: paste this code into an empty cell, and the marimo editor will create cells for you

import marimo

__generated_with = "0.10.6"
app = marimo.App()


@app.cell
def _():
    import marimo as mo
    return (mo,)


@app.cell
def _(mo):
    button = mo.ui.run_button()
    button
    return (button,)


@app.cell
def _(button, mo):
    mo.stop(not button.value, "Click the button to continue")

    mo.md("# :tada:")
    return


if __name__ == "__main__":
    app.run()