© 1999 Timothy Lipetz  

Beginners Guide

Topics on this page: Getting Started with TinyLogo, About Turtle Graphics, Repeating Commands, Extending TinyLogo with Your Own Procedures, Some Useful System Commands

See also: TinyLogo Main, Beginners Guide, Advanced Information, Built-in Procedures, Samples

This page contains a tutorial that should help you get started with TinyLogo. If you are interested in more information, I suggest you visit one of these Logo web sites, or find a Logo book at your library. You will still want to review this document in order to adjust for the handful of differences between TinyLogo and other Logo implementations.

Getting Started with TinyLogo

When you first start TinyLogo, it will take about ten seconds to initialize. You will then see this screen…

Press the "Scroll Up" button and you will see this screen…

This is where you enter your TinyLogo commands. For now try entering


and tap the Okay button. A complete listing of the TinyLogo commands will be displayed. These commands (or "Procedures" as they are called in TinyLogo) are also listed in the tables below. Notice that the built-in procedures for TinyLogo are all written with lower case letters.

Also, notice that some commands are followed by a short command in parentheses, these are the "aliases" for those comands and are the short form you can use in place of the full word. For example,


means you can enter either "print" or "p" for the same instruction.

Now let’s try a simple command. Enter…

print sum 3 4

TinyLogo responds with


This is the basic interactive mode of TinyLogo. You enter a command and it responds with the evaluation of the command. There are other modes where you can store a set of commands and have TinyLogo interpret them all together. We’ll cover that later.

Notice that arithmetic in TinyLogo uses what are called "Prefix" operators. This means the command precedes the numbers or expression it operates on. Instead of the operators (+,-,*,/), we used (sum, difference, product, quotion) or as aliases (sum, dif, prd, quo). So instead of

3 + 4

we write

sum 3 4

Another example, instead of

3 * ( 4 – 2 )

we write

prd 3 dif 4 2

Although this may seem odd at first, you will get used to it quickly.

Let’s try another interactive command, this time working with words instead of numbers. Enter…

print butfirst "Tiny

TinyLogo responds with


Notice that when entering a word to be treated as data (Tiny in this case), you precede it by a quotation mark. There is no terminating quotation mark. Also, notice that the command, butfirst, gives everything in the word except the first letter.

We could have used aliases to shorten our entry, like this…

p bf "Tiny

The same butfirst command can work with sentences (or "Lists" as they are called in TinyLogo) of words. A list is written by surrounding words (or numbers) with square brackets. For example, enter…

print butfirst ["TinyLogo "is "fun]

TinyLogo responds with

is fun

 One more thing to try. Let's make a mistake intentionally. Mistakes are no big deal. If you are experimenting a lot, you can often learn as much from your mistakes. Try entering this…


TinyLogo can't complete your command, because you didn't tell it what to print. So you will see an error message…

About Turtle Graphics

Most Logo or TinyLogo beginners like to start with Turtle Graphics. And for good reason. The immediate feedback from your commands really speeds learning and makes your experiments more satisfying.

To make TinyLogo go into Turtle Mode, enter turtle or tu.

To leave Turtle Mode, enter noturtle or ntu.

When you first enter Turtle Mode the screen looks like this…

The triangle is called the "Turtle" and it obeys your commands to move around the screen. The ">>" in the bottom left corner tells you that TinyLogo is ready to receive your next command. So let's press the "Scroll Up" button, which gives us the same command entry box as before. Try entering…

forward 30

Notice that the Turtle moved forward 30 pixels and left a line behind. Now try entering…

right 90 forward 30

The screen now looks like…

The command right 90 told the Turtle to turn 90 degrees to its right. Also, notice that we were able to enter more than one command at a time. In fact, we could turn these two lines into a square with this compound command …

rt 90 fd 30 rt 90 fd 30 rt 90

Experiment with Turtle graphics commands, there are several. A few useful ones are: left(lf), right(rt), forward(fd), backward(bk), clearscreen(cs), home, hideturtle(ht), showturtle(st), penup(pu), pendown(pd).

Repeating Commands

In the above example, we entered the commands for all four sides and corners of the square, but we don't need to enter so much. Programming languages are perfect for doing repeating operations. In TinyLogo one way to repeat things is with the repeat(rep) command. (Another, more advanced way to repeat things is with recursion.) The repeat command is followed by two arguments. The first is the number of times to repeat, and the second is a list of commands to execute each time. Try this…

clearscreen home repeat 4 [ forward 30 right 90 ]

Or with aliases…

cs home rep 4 [ fd 30 rt 90 ]

Aha, we drew a square. Notice how much shorter the command is with the repeat. Experiment with different repeat commands. Try putting one inside the list of another.

Extending TinyLogo with Your Own Procedures

Even though the command to draw a square using the repeat was compact, if we need lots of squares, we might want something even simpler. In fact, what we would really like is for TinyLogo to have a square command in it.

Well we are in luck. We can add procedures to TinyLogo that become as much a part of the language as the built-in procedures. Here is an example with our square…

to square rep 4 [fd 30 rt 90]end

The to command starts a definition of a new procedure and the end command finishes it. So in this example we are telling TinyLogo how to square. Once TinyLogo accepts this procedure definition, we can use it just like a built-in procedures. For example…

cs square

or even…

cs rep 6 [square rt 60] hideturtle

which gives us…

But what if we wanted our squares to be of different sizes, do we have to write a different square procedure for each size? No there is a simpler solution. In the same way that built-in procedures can take arguments (forward takes a distance in pixels, etc.), your procedures can be written to take arguments. For example,

to sq :len rep 4 [fd :len rt 90]end

The first occurrence of :len tells TinyLogo that sq will expect to be followed by one argument called :len. The second occurrence tells TinyLogo what to do with the value of that argument when it is provided, that is, move forward by whatever number of pixels was given as the argument to sq. Try this…

sq 10 sq 20 sq 30

Or even this…

rep 12 [sq sum 10 prd cnt 3 rt 10]

Which produces this...

This concludes the guided introduction for beginners. There is a lot more to discover. Experiment on your own. But first here are some useful commands for working with TinyLogo...

Some Useful System Commands

Stopping a procedure

You can halt a running TinyLogo program by holding down the "Scroll Down" button. It may take a few seconds before TinyLogo detects the button. TinyLogo will then return to the "ready to get input" mode.

Dealing with lengthy output

When you are not in Turtle mode, the output accumulates into a scrollable region of the screen. You may notice that output slows down as the region gets full. It is safe to select the "Clear" button below the scrollable region even while your procedure is still running. This can improve performance when you have lengthy output.

Continuing a long command on several lines

You can continue a long command by ending it with a "+" and then selecting okay on the input. TinyLogo will show you the partially completed command, but will not attempt to execute it. You can do this for several lines. When a line is entered without the terminating "+" the entire set of lines will be executed.

Editing commands

Until you select the "Okay" on the input popup, you can reedit the command line by sweeping text and entering the changes.

To enter a correction or modification to the previous one-line command, enter a "-" and select "Okay." The input dialog will pop up with the previous command as the default value. You can then edit it by sweeping text and entering the changes. Note: you can only back up one command.

After a continued line has been entered (using "+" - see above), you can change it by entering a "-" and selecting "Okay." The input dialog will pop up with the previous line from the continued command as the default value. That line will have been removed from the continued command, so you can correct it and reenter it. Note: you can only back up one line of a continued command.

To reedit a user-defined procedure from within TinyLogo...(Not yet implemented in TinyLogo). For now, either reenter it or save it to a memo and edit it there.

Note: when reentering a procedure that TinyLogo already knows, the new definition completely replaces the old one. If you change the number of arguments when you do this, TinyLogo will give you a warning that this might break any existing TinyLogo code that uses the procedure with the old number of arguments.

Of course, you are not allowed to edit or redefine any of the built-in procedures.

Saving Procedures

To save a procedure definition to a memo, use saveproc or sp

saveproc "myproc "memoname

This example will append the procedure "myproc" to the end of a memo "TL_memoname" (you do not enter the "TL_"). If the memo does not exist it will be created. Be sure to quote the arguments.

Loading Procedures

To load a set of procedures from a memo, use load or ld

load "memoname

This example will load all the procedures defined in the memo "TL_memoname" (you do not enter the "TL_"). Be sure to quote the argument.

Sharing Procedures with Others

When you save a set of procedures using saveproc or sp they are written as a memo in memopad.

The easiest way to share that memo is to HotSync, startup the Palm Desktop, sweep out and copy the memo (Ctrl_A Ctrl_C in Windows), and then paste it into an Email or Text file (Ctrl_V in Windows). Of course, you reverse the steps to load a TinyLogo memo from someone else.

Other Useful System commands.

A complete list of TinyLogo system procedures is listed in TinyLogo Workspace.

See also: TinyLogo Main, Beginners Guide, Advanced Information, Built-in Procedures, Samples