stop

stop

The calling agent exits immediately from the enclosing procedure, ask, or ask-like construct (crt, hatch, sprout, without-interruption). Only the current procedure stops, not all execution for the agent.

if not any? turtles [ stop ]
;; exits if there are no more turtles

Note: stop can be used to stop a forever button. If the forever button directly calls a procedure, then when that procedure stops, the button stops. (In a turtle or patch forever button, the button won't stop until every turtle or patch stops -- a single turtle or patch doesn't have the power to stop the whole button.)

Take me to the full NetLogo Dictionary