Command | Alternative | Description of command | Example |
---|---|---|---|
forward <x> | fd <x> | Move the turtle forward on x points. | forward 10 |
back <x> | bk <x> | Move the turtle back on x points. | back 10 |
left <a> | lt <a> | turtle rotation by a degrees to the left. | left 90 |
right <a> | rt <a> | turtle rotation by a degrees to the right. | right 90 |
penup | pu | Lifting turtle. Turtle stops drawing the line. | penup |
pendown | pd | Laying turtle. The turtle will draw a line. | pendown |
showturtle | st | Viewing turtle. Turtle will be visible. | showturtle |
hideturtle | ht | Hiding turtle. Turtle will be invisible. | hideturtle |
home | Turtle will stand to the middle of the screen (in its default position). | home | |
clean | Erases the entire canvas. | clean | |
clearscreen | cs | Performs command home and clean. | clearscreen |
Expression | Description of expression | Example |
---|---|---|
( <x> ) | Brackets. It is recommended to add all the missing brackets in mathematical expressions. | (10 + ((sin 5) ^ 3)) |
<x> + <y> | Total numbers x a y. | 10 + 5 |
<x> - <y> | Difference of numbers x a y. | 10 - 5 |
<x> * <y> | The product numbers x a y. | 10 * 5 |
<x> / <y> | Share numbers x a y. | 10 / 5 |
<x> ^ <y> | Power, xy. | 10 ^ 2 |
sqrt <x> | Square root of number x. | sqrt 100 |
sin <x> | Trigonometric sine function. Number x is the angle in degrees. | sin 45 |
cos <x> | Trigonometric functions cosine. Number x is the angle in degrees. | cos 45 |
tan <x> | Trigonometric functions tangent. Number x is the angle in degrees. | tan 45 |
arcsin <x> | Inverse trigonometric function sine. x is the number and the result is returned in degrees. | arcsin 1 |
arccos <x> | Inverse trigonometric function cosine. x is the number and the result is returned in degrees. | arccos 1 |
arctan <x> | Inverse trigonometric function tangent. x is the number and the result is returned in degrees. | arctan 1 |
Command | Description of expression | Example |
---|---|---|
repeat <K> [ <commands> ] | Turtle repeated block to the <K>-times. | repeat 4 [ left 90 fd 50 ] |
if <C> [ <commands> ] | Simple branching. If the turtle evaluate <C> be true, then executes the next block of commands. | if 1 < 4 [ left 90 fd 50 ] |
ifelse <C> [ <commands1> ] [ <commands2> ] | Branching with else. If the turtle evaluate <C> be true, then makes a block of commands1, otherwise the block of commands2. | if 1 > 4 [ left 90 fd 50 ] [ right 90 fd 50 ] |
to <name> <parameters> <commands> end | Function definition name. The parameters of function are variables beginning with a colon and are separated by a space. The function body follows. | to triangle :side repeat 3 [ right 120 fd :side ] end |