Newtro Logo

Logo is the programming language that put a turtle on the screen in 1967. Type a command at the ? prompt and the turtle carries it out. Teach it new words with TO, and it remembers them next time you visit.

? FD 100

This terminal needs JavaScript to run.

0 draws instantly

Try a program

Each one runs in the terminal above. Read the code, run it, then change a number and see what happens.

Everything the turtle understands

Short forms are in brackets. Commands work in upper or lower case. The turtle starts in the middle facing up, and 0 degrees is straight up.

Moving

FORWARD 100 (FD)
Move forward 100 steps.
BACK 50 (BK)
Move backward.
RIGHT 90 (RT)
Turn clockwise by degrees.
LEFT 45 (LT)
Turn counterclockwise.
HOME
Return to the middle, facing up.
SETXY 50 -20
Go straight to a point.
SETHEADING 180 (SETH)
Face a direction.
ARC 180 50
Draw part of a circle around the turtle.
CIRCLE 40
Draw a full circle around the turtle.

Pen and screen

PENUP (PU)
Move without drawing.
PENDOWN (PD)
Draw again.
PENERASE (PE)
Rub out lines as you move.
SETPENCOLOR 4 (SETPC)
A color number, a name like "RED, or [R G B] from 0 to 255.
SETPENSIZE 3
Make the line thicker.
SETBACKGROUND 1 (SETBG)
Change the screen color.
CLEARSCREEN (CS)
Wipe the screen and go home.
HIDETURTLE (HT)
Hide the turtle. SHOWTURTLE (ST) brings it back.
LABEL "HELLO
Write text where the turtle is.
SPEED 10
From 1, slow, to 10, fast. 0 is instant.

Repeating and deciding

REPEAT 4 [ ... ]
Run the list a number of times. REPCOUNT says which time it is.
FOR [I 1 10 2] [ ... ]
Count from 1 to 10 in steps of 2.
IF :X > 5 [ ... ]
Run the list only when the test is true.
IFELSE test [ ... ] [ ... ]
Choose between two lists.
WHILE [test] [ ... ]
Keep going while the test is true.
FOREVER [ ... ]
Keep going until you press Esc.
WAIT 60
Pause. 60 is one second.

Teaching new words

TO SQUARE :SIZE ... END
Define a procedure with inputs. Type it over several lines.
STOP
Leave the procedure now.
OUTPUT value (OP)
Give a value back to whoever asked.
MAKE "SIDE 50
Store a value. Read it back with :SIDE.
LOCAL "X
Keep a variable inside one procedure.
POTS
List your procedures. PO "NAME shows one.
ERASE "NAME (ER)
Forget a procedure. ERALL forgets them all.

Numbers and words

+ - * / = < >
Arithmetic and comparisons.
PRINT SUM 2 3 (PR)
Show a result. SHOW keeps list brackets.
RANDOM 10
A whole number from 0 to 9.
SQRT, POWER, SIN, COS
Math, with angles in degrees.
INT, ROUND, ABS, MODULO
Tidy up numbers.
FIRST, LAST, BUTFIRST, ITEM
Take apart words and lists.
LIST, SENTENCE, WORD, PICK
Build them up, or choose at random.

The terminal

HELP
A quick reminder.
Up and down arrows
Bring back earlier commands.
Esc
Stop a running program.
Paste
Paste a whole program to run it at once.
CLEARTEXT (CT)
Clear the text lines.
GAMES
What else we're making.

Pen colors

  1. 0 black
  2. 1 blue
  3. 2 green
  4. 3 cyan
  5. 4 red
  6. 5 magenta
  7. 6 yellow
  8. 7 white
  9. 8 brown
  10. 9 tan
  11. 10 forest
  12. 11 aqua
  13. 12 salmon
  14. 13 purple
  15. 14 amber
  16. 15 gray

Why a turtle?

Wally Feurzeig, Seymour Papert and Cynthia Solomon created Logo in 1967 so children could learn by making things. The turtle started as a small robot that crawled across the floor with a pen. It moved onto screens, and into school computer labs everywhere.

Our puzzle game One Command Ahead grew from that same idea: a few clear instructions, a very literal machine, and the fun of watching your plan play out.