### ask

#### ask agentset [commands]
ask agent [commands]

The specified agent or agentset runs the given commands.

    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 right

Note: 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.

Take me to the full NetLogo Dictionary