die is a primitive that we use to remove turtles and links from a model. When a turtle or link is asked to die, it no longer exists in the model, it will not execute any more code, and it will disappear from any agentset it was in. For example, the following model would have 9 turtles.
create-turtles 10
ask one-of turtles [ die ]
In the model example below, a flock of cows move around on a grassland. Every time they are on a green patch, they eat the grass there and gain energy. Every time they move, they lose some energy. If a grass ever has 0 energy, it dies and removes itself from the model.
Once you mastered the die primitive, don't stop there. Check out the resources below to improve your NetLogo skills.
die primitive:create-turtlesCreates turtles with random colors and headings at the center of the world.