When you first start Logo you'll reach a ? prompt. From here you can enter Logo commands.

We could write Hello, World, but that's boring. Let's get straight to the good stuff and draw some Turtle graphics!

Type in this line and watch the Turtle go! It will take quite a while to finish if your emulator is running at normal speed:

`REPEAT 20 [REPEAT 180 [FD 1 RT 2] RT 18]`

You can see the results at the bottom of the page.

Now that we've done something cool, let's unpack it and see what the commands did. REPEAT takes a number and a list, then it runs the list that many times. With the first one we're repeating whatever is in the list 20 times. A list is contained in square brackets and is made up of Logo objects, in this case we have two commands: another REPEAT with its own list and RT 18.

The inner REPEAT has its own list, [FD 1 RT 2]. These two commands are shorthand versions of turtle commands FORWARD and RIGHT. It tells the turtle to move forward one unit, then turn right 2 degrees. Repeat this 180 times and you get a circle (2 degrees * 180 = 360)! After completing the REPEAT there's another RT, so once the circle is done we turn right 18 degrees. See where this is going? Repeat that 20 times and you get another circle (20 * 18 = 360). Now we've got a circle of circles!

You can clear the screen by typing CLEARSCREEN. Try doing REPEAT 180 [FD 1 RT 2] and you'll see one component of the larger drawing that we just made.

## Commands

Here's an overview of some turtle commands and their shorthand equivalents:

CLEARSCREEN - Clear the screen. (Shorthand: CS)

HIDETURTLE - Don't show the turtle cursor. (HT)

SHOWTURTLE - Show the turtle cursor. (ST)

HOME - Move back to the home position.

FORWARD steps - Move forward steps. (FD)

BACK steps - Move back steps. (BK)

LEFT degrees - Turn left this many degrees. Negative degrees work too, they'll turn it right. (LT)

RIGHT degrees - Turn right this many degrees. (RT)

SETPOS [x y] - Set the position to x, y coordinates. These are Cartesian, so 0,0 is the middle of the screen.

SETX x - Set the horizontal position to x.

SETY y - Set the vertical position to y.

This guide was first published on Jul 02, 2019. It was last updated on Jun 24, 2019.