ask 1.0
ask agentset commands
ask agent commands
The specified agent or agentset runs the given commands. Because agentset members are always read in a random order, when ask is used with an agentset each agent will take its turn in a random order. See Agentsetsfor more information.
ask turtles [ fd 1 ]
;; all turtles move forward one step
ask patches [ set pcolor red ]
;; all patches turn red
ask turtle 4 [ rt 90 ]
;; only the turtle with id 4 turns rightNote: only the observer can ask all turtles or all patches. This prevents you from inadvertently having all turtles ask all turtles or all patches ask all patches, which is a common mistake to make if you’re not careful about which agents will run the code you are writing.
Note: Only the agents that are in the agentset at the time the ask begins run the commands.