Free Online Turtle Graphics : logointerpreter.com - Surf your logo code!
Turtle Graphics - Basic Motion

[Index] [<< Previous section: The Graphics Canvas] [Next section: Curved Paths >>]

forward expr
fd expr
Description: moves the turtle forward expr pixels, in the direction it is facing.
Examples:
fd 100
fd -50.25
Note that you can use negative values to go backwards.
back expr
bk expr
Description: moves the turtle backward expr pixels, exactly opposite to the direction that it's facing.
Examples:
bk 80
bk -35.75
Note that you can use negative values to go forward.
left expr
lt expr
Description: rotates the turtle expr degrees counterclockwise.
Examples:
lt 90.30
lt -45
Note that you can use negative values to rotate clockwise.
right expr
rt expr
Description: rotates the turtle expr degrees clockwise.
Examples:
rt 120
rt -60
Note that you can use negative values to rotate counterclockwise.
setpos [ expr expr ]
Description: moves the turtle to the specified location without drawing. The input is a list of two numbers, the X and Y coordinates.
Example:
setpos [100 100]
setxy expr expr
Description: moves the turtle to the specified location without drawing. The two inputs are numbers, the X and Y coordinates.
Example:
setxy 100 100
setx expr
Description: moves the turtle horizontally from its old position to a new horizontal coordinate. expr is the new X coordinate.
Example:
setx 150
sety expr
Description: moves the turtle vertically from its old position to a new vertical coordinate. expr is the new Y coordinate.
Example:
sety -220
setheading expr
seth expr
Description: turns the turtle to a new heading. expr is a number, the heading in degrees clockwise from the positive Y axis.
Example:
seth 120
home
Description: moves the turtle to the initial position (canvas center), pointing upwards.
Example:
home

[Index] [<< Previous section: The Graphics Canvas] [Next section: Curved Paths >>]
  1. Turtle Graphics section's content: Go to top
IT&C Essentials, Math, User's Guide!
(free online courses & quizzes)
Online Turtle Graphics - a free and modern web-based logo interpreter
Create an account now! It's EASY and FREE. Learn Logo & Turtle Graphics!
Find us on facebook
Get social with us!
World Map
Check other turtles
around the world!
Need help?
Browse our
support topics
Logo reference
Learn about your
turtle's language