Try telling the turtle to draw a square by typing this command four times:
fd 50 rt 90
Change the 90 to 120, 72, 45 or 144 to change the shape to a triangle, pentagon, octagon or five-pointed star.
You can send the turtle home and clear the screen by typing:
home cs
To repeat a command several times, use the repeat command:
repeat 8 [fd 50 rt 45]
A circle can be drawn as a many-sided shape, like this:
repeat 180 [fd 3 rt 2]
To get fancy, use a repeat command inside another repeat command:
repeat 10 [repeat 5 [fd 50 rt 72] rt 36]
Use setxy and random to scribble lines all over the screen:
repeat 200 [setxy random * 600 - 300 random * 600 - 300]
Teach the turtle new commands using the to command, or make changes to them using the edit command:
to star
edit star
Move the turtle forward by the given distance.
Move the turtle backward by the given distance.
Rotate the turtle clockwise by the given angle.
Rotate the turtle counterclockwise by the given angle.
Disable the turtle's pen so it won't draw lines when moving.
Enable the turtle's pen so it will draw lines when moving.
Make the turtle invisible.
Make the turtle visible.
Set the width of the lines that the turtle draws.
Set the turtle's pen color to one of 16 different colors. :color can be any number, but it is converted to an integer and reduced into the range 0-15.
Move the turtle directly to position (:x, :y). As usual, if the turtle's pen is down, it will draw a line as it moves.
Move the turtle to its home position of (0, 0), which is the center of the screen in fullscreen mode. As usual, if the turtle's pen is down, it will draw a line as it moves.
Clear the screen.
Set the screen mode to fullscreen. You can use the Escape key to exit back to splitscreen mode.
Set the screen mode to splitscreen (the default mode).
Set the screen to textscreen (full text) mode. When in textscreen mode, running any turtle command will restore the screen back to splitscreen mode. You can also get to textscreen mode by pressing Escape when in splitscreen mode.
Returns the turtle's current x or y coordinate.
Returns the current rotation angle of the turtle as an angle between -180 and 180.
Returns the current width or height of the screen in the turtle's native coordinates. The larger of the two dimensions is always exactly 600. In splitscreen mode, the height includes the part of the screen that is obscured by the text console. In other words, the height does not change when switching between textscreen, splitscreen and fullscreen modes. You can use these commands to move the turtle to the top-left corner of the screen:
setxy currentwidth / -2 currentheight / 2
Returns the current program speed, as set by the speed command.
Opens the full-screen editor to start defining a new procedure. For example:
to polygon :length :sides
This will start defining a new procedure that accepts two parameters named :length and :sides. When done defining the procedure, you can save it by clicking the Save button at the bottom of the editor screen.
The given procedure name must not be defined yet. To edit an existing procedure, use the edit command instead.
Defined procedures are preserved in your web browser's local storage when you close and re-open this web page. They are also shared across browser tabs if you have the page open in multiple tabs.
Opens the full-screen editor to start editing an existing procedure. For example:
edit polygon
Unlike the to command, you don't need to pass the parameter names.
Returns a list of all currently defined procedures.
Deletes a procedure.
Deletes all procedures. This command brings up a confirmation dialog to ensure you really meant to run it.
This command marks the end of the procedure in the full-screen editor. When used in any other context, it has no effect.
Defines a global variable. For example:
make "a 57
fd :a
The above sequence defines a variable named :a with the value 57. It then tells the turtle to move forward :a, which causes a move of 57 units.
Defines a local variable. This is identical to make, except that the created variable is only visible in the context of the procedure in which it's defined. Local variables have the same scope as parameters that are passed into a procedure. The local command can be used to change the value of procedure parameters.
Returns the list of currently defined global variables.
Returns the list of local variables defined in the current context.
Executes the commands in the given list if the condition is true. Examples:
if 5 < 6 [show "Yes!]
if "true [show "Yes!]
if "false [show "Nope.]
Executes either :list1 or :list2, depending on whether the condition is true or false (respectively).
Executes the given list :n times.
Interrupts program execution. This does the same thing as pressing Escape while a program is running. The cont command can be used to resume the program from where it left off.
Resumes a stopped program.
Returns the sine of the given angle (in degrees).
Returns the cosine of the given angle (in degrees).
Returns the tangent of the given angle (in degrees).
Rounds the given value down.
Returns a random number in the range [0, 1).
Returns a list containing just the provided value.
Concatenates the given lists or strings into a longer list or string.
Returns the list element or character at the specified position in the given list or string.
Returns a sub-list or substring of the given list or string, with the specified length, beginning at the specified index.
Returns the length of the given list or string.
Saves all currently defined procedures into a file with the given name. If the file already exists, it is overridden.
Loads procedures from the given file. Any procedures that were defined before the load command are erased.
Deletes the file with the given filename.
Returns a list of all saved files.
Set the program speed. The speed can be any positive integer, but if the number gets too large, the speed won't increase much more, and it may become more difficult to interrupt a long-running program.
Returns a list of all built-in commands.
Shows this help page.
Displays a given value in the console.
Logo is an educational programming language designed in 1967 by Wally Feurzig, Seymour Papert and Cynthia Solomon. Many dialects of Logo have been created for many platforms.
JP's Web Logo was created by John-Paul Gignac. It's intended to be a simple, minimal Logo dialect with a friendly interface. It's primarily inspired by the Commodore 64 Logo by MIT and Terrapin.