NetLogo 7.0.0-beta2:

die1.0

die Turtle Command Link Command

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 die

A 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 nobody in it. So for example let x one-of turtles ask x [ die ] print x prints nobody.
  • 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-perspective had been run.

See also: clear-turtles clear-links

Take me to the full NetLogo Dictionary