Pencil Code Reference > lt

 

lt turns the turtle left

lt pivots the turtle clockwise (lt stands for "left turn").

The turn is measured in degrees.

lt 90

Notice that the turtle will not actually move in the new direction until you tell it to move forward with fd.

Drawing Angles

When using a pen, putting lt between two fd moves can draw an angle.

pen lime
fd 100
lt 120
fd 100

Notice that the angle used by lt is the exterior angle. The interior angle added to the exterior angle will be 180. For example, the 60 degree interior angle drawn by the program above corresponds to the 120 degree exterior angle swept out by the turtle.

Turning an Upside-Down Turtle

lt turns left from the turtle's point of view, so if the turtle is facing downward, when it turns left from its point of view, it will end up facing right from your point of view. The demo below can be clicked a few times to show different starting directions.

turnto random 360
pen orange
fd 100
lt 100
fd 100

Drawing Arcs

lt can also be used to draw arcs by using a second argument. Read the reference page on arcs.