exit
Stop script execution immediately.
Smart blocks: cannot be nested. This command performs an immediate wallet, RPC, external-service or control-flow operation and cannot run inside an atomic batch.
Syntax
Section titled “Syntax”exitExamples
Section titled “Examples”# Stop script executionprint "before"exitexitis a clean stop, not an error: actions produced before it have already executed, everything after it is skipped.- It stops the whole script from anywhere — including inside
loopblocks anddefcommand bodies. Useloop breakto leave just the loop, ordef returnto leave just the command body.