Tortue: A LOGO Interpreter in Java
Home
News
Downloads
Screenshots
Artwork
Documentation
Contact Information
Links

Tortue is hosted by:
SourceForge.net

Tortue Language Reference

Commands are entered on individual lines. Tortue commands and variables are not case-sensitive.
The following commands are currently supported by Tortue:

FORWARD

Move <amount> forward, producing a line.

Format:
FORWARD ?? (Where ?? is the amount to move, either a number or a variable)

Example:
FORWARD 50

BACKWARD

Move <amount> backwards, producing a line.

Format:
BACKWARD ?? (Where ?? is the amount to move, either a number or a variable)

Example:
BACKWARD 50

LEFT

Rotate the cursor left by <amount> degrees.

Format:
LEFT ?? (Where ?? is the amount to rotate, either a number or a variable)

Example:
LEFT 90

RIGHT

Rotate the cursor right by <amount> degrees.

Format:
RIGHT ?? (Where ?? is the amount to rotate, either a number or a variable)

Example:
RIGHT 90

SETX

Move the cursor to the specified X location.

Format:
SETX ?? (Where ?? is the position to move to, either a number or a variable)

Example:
SETX 90

SETY

Move the cursor to the specified Y location.

Format:
SETY ?? (Where ?? is the position to move to, either a number or a variable)

Example:
SETY 90

PENDOWN

Causes subsequent drawing commands (forward/backward) to be drawn.

Format:
PENDOWN

Example:
PENDOWN

PENUP

Causes subsequent drawing commands (forward/backward) to not be drawn.

Format:
PENUP

Example:
PENUP

PENCOLOR

Change the pen color. Available colors are: black, blue, cyan, darkgray, gray, green, lightgray, magenta, orange, pink, red, white, yellow.

Format:
PENCOLOR ?? (Where ?? is the color)

Example:
PENCOLOR RED

PENCOLOR

Change the pen color to the specified red, green, blue, and alpha values.

Format:
PENCOLOR <RR> <GG> <BB> <AA> (RR = red, GG = green, BB = blue, AA = alpha)

Example:
PENCOLOR 128 0 128 255

CANVASCOLOR

Change the pen color. Available colors are: black, blue, cyan, darkgray, gray, green, lightgray, magenta, orange, pink, red, white, yellow.

Format:
CANVASCOLOR ?? (Where ?? is the color)

Example:
CANVASCOLOR RED

CANVASCOLOR

Change the pen color to the specified red, green, and bluevalues.

Format:
CANVASCOLOR <RR> <GG> <BB> (RR = red, GG = green, BB = blue)

Example:
CANVASCOLOR 128 0 128

DRAWSTRING

Draw the specified string at the current location.

Format:
DRAWSTRING <message>

Example:
DRAWSTRING Hello World!

FONTNAME

Use the specified font name when drawing messages. Accepted fonts are: Dialog, DialogInput, Monospaced, Serif, SansSerif, or Symbol.

Format:
FONTNAME <font>

Example:
FONTNAME SERIF

FONTSIZE

Use the specified font size when drawing messages.

Format:
FONTSIZE <size>

Example:
FONTSIZE 36

FONTSTYLE

Use the specified style when drawing messages. Accepted styles are: PLAIN, BOLD, ITALIC..

Format:
FONTSTYLE <style>

Example:
FONTSTYLE BOLD

CLEAR

Clears the screen.

Format:
CLEAR

Example:
CLEAR

HOME

Moves the cursor to the center of the screen.

Format:
HOME

Example:
HOME

NEW

Starts a new drawing.

Format:
NEW

Example:
NEW

MAKE

Define a variable with the specified value.

Format:
MAKE <variable name> = ?? (Where ?? is a number or a variable name)

Example (define variable TEST with 100):
MAKE TEST = 100

CONTENT

Displays the value of the variable (or 0 if the variable is undefined).

Format:
CONTENT <variable name>

Example:
CONTENT TEST

SUM

Add two values together and put the result into the specified variable.

Format:
SUM <variable name> = ?? + ?? (Where ?? is a number or a variable name)

Example:
SUM TEST = 10 + 20

SUBTRACT

Subtract two values and put the result into the specified variable.

Format:
SUBTRACT <variable name> = ?? - ?? (Where ?? is a number or a variable name)

Example:
SUBTRACT TEST = 30 - 10

MULTIPLY

Multiply two values and put the result into the specified variable.

Format:
MULTIPLY <variable name> = ?? * ?? (Where ?? is a number or a variable name)

Example:
MULTIPLY TEST = 20 * 20

DIVIDE

Divide two values and put the result into the specified variable.

Format:
DIVIDE <variable name> = ?? / ?? (Where ?? is a number or a variable name)

Example:
DIVIDE TEST = 30 / 5

REPEAT

Repeat all commands until END REPEAT is reached for the specified number of times.

Format:
REPEAT ?? (Where ?? is the number of times to repeat. Can be a number or a variable)
<commands>
END REPEAT

Example (to draw a square):
REPEAT 4
FORWARD 50
LEFT 90
END REPEAT

TO

Define a set of commands that can be called using the specified name.

Format:
TO <name>
<commands>
END TO

Example (define a command "square", and then call the command):
TO SQUARE
FORWARD 50
LEFT 90
FORWARD 50
LEFT 90
FORWARD 50
LEFT 90
FORWARD 50
LEFT 90
END TO
 
SQUARE

IF

Execute the commands until END IF is reached, if the specified condition is true. Conditions are: = (equals), < (less than), > (greater than), ! (not equal)

Format:
IF <value1> <condition> <value2>
<commands>
END IF

Example (draw a line if 10 is less than 100):
IF 10 < 100
FORWARD 50
END IF