How can you break ask in netlogo

netlogo

Solution

Well, `stop` does break out of `ask`. From the documentation of `stop`:

This agent exits immediately from the enclosing procedure, ask, or ask-like construct (e.g. crt, hatch, sprout). Only the current procedure stops, not all execution for the agent.

So you can do things like:

ask turtles [
  if stop-condition? [ stop ]
  move-to one-of patches ; or whatever
]
print "done!"

...and as soon as `stop-condition?` becomes true, the execution will break out of the `ask` block and "done!" will be printed.

Problem

How can you break ask in netlogo? For example..agents are moving and suddenly some condition has satifised. Now you don't want ask agents to execute(move) and stop ask. And pass control to next line after ask. Something similar exists in procedures called "stop". But not for ask. Is there a way around?

Original source