forward

 

forward is a turtle primitive that makes the asked turtle move forward on a straight patch for a provided number of units. The shorthand version of this primitive is fd.

ask turtles [
    forward 2
]
ask turtle 0 [
    fd 3.35
]

Things to keep in mind when using forward:

In the model example below, we have a road represented with gray patches and a car on the road. We use the set heading 90 code in our setup procedure to make sure that our car is heading towards east. Our model has 3 different go buttons: go-slow, go-fast, and go-back, each doing exactly what the name suggests.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the forward primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the forward primitive:
 
 
Similar primitives:
right

Changes a turtle's heading a certain amount of degrees to the right.

Read more
random

Reports a random whole number between 0 and a specified number.

Read more
turtles

Reports an agentset that contains all the turtles in a model.

Read more
move-to

Moves a turtle to set its x and y coordinates to be the same as another turtle or patch.

Read more
 
Learn another primitive: