die 1.0
die


The turtle or link dies.
if xcor > 20 [ die ]
;; all turtles with xcor greater than 20 die
ask links with [color = blue] [ die ]
;; all the blue links will dieA dead agent ceases to exist. The effects of this include:
- The agent will not execute any further code. So if you write
ask turtles [ die print "last words?" ], no last words will be printed, because the turtles are already dead before they have a chance to print anything. - The agent will disappear from any agentsets it was in, reducing the size of those agentsets by one.
- Any variable that was storing the agent will now instead have
nobodyin it. So for examplelet x one-of turtles ask x [ die ] print xprintsnobody. - If the dead agent was a turtle, every link connected to it also dies.
- If the observer was watching or following the agent, the
observer’s perspective resets, as if
reset-perspectivehad been run.
See also: clear-turtles clear-links