clean
Clear the screen and reposition the turtle to the center.
clean
forward
Move the turtle forward.
fd 100
back
Move the turtle backward.
bk 100
right
Turn the turtle right.
fd 100 rt 90 fd 100
left
Turn the turtle left.
fd 100 lt 90 fd 100
arc
Draw an arc.
arc 180 100
arc -180 100
setxy
Set the position of the turtle.
setxy 100 100
setxy -100 -100
xcor
The x (horizontal) coordinate of the turtle.
print xcor
ycor
The y (vertical) coordinate of the turtle.
print ycor
setheading
setheading direction
seth direction
Set the heading of the turtle.
seth 45
heading
The heading of the turtle.
seth 90 setc heading fd 100
penup
Raise the turtle's pen so that it will not draw.
repeat 10[fd 5 pu fd 5 pd]
pendown
Lower the turtle's pen so that it will draw.
repeat 10[fd 5 pu fd 5 pd]
setpensize
setpensize size
setps size
Set the width of the turtle's pen.
setps 8 fd 50
forward 0 draws a fill circle with the radius equal to the pen size
setps 50 fd 0
pensize
The width of the turtle's pen.
print pensize
setcolor
setcolor number
setc number
Set the color of the turtle's pen.
setc 0 fd 50 setc 60 fd 50
color
The color of the turtle's pen.
repeat 10 [fd 5 setc color + 10]
setshade
setshade number
setsh number
Set the shade of the turtle's pen.
setsh 30 fd 50 setsh 50 fd 50 setc 80 fd 50
shade
The shade of the turtle's pen.
setsh 0 repeat 10 [fd 5 setsh shade + 10]
startfill
Mark the start of an area to be filled.
Try
startfill repeat 6 [fd 100 rt 60] endfill
endfill
Mark the end of the area and fill it.
startfill repeat 6 [fd 100 rt 60] endfill
fillscreen
Fill the screen with a color and a shade.
fillscreen 30 50
Arithmetic in ArtLogo proceeds from right to left.
1+2*3 is read as 1+(2*3)
sum
sum number number
number + number
Add two numbers.
print sum 11 10
print 11 + 10
-
Subtract one number from another.
print 11 - 10
*
Multiply two numbers.
print 11 * 10
/
Divide one number by another.
print 11 / 10
remainder
Calculate the remainder when dividing two numbers.
print remainder 11 2
round
Round a number.
print round 1.7
minus
Negate a number.
print minus 10
random2
Generate a random number between the two specified values.
repeat 10 [setc random2 0 100 fd 5]
oneof
Choose one of two numbers.
repeat 10 [setc oneof 90 55 fd 5]
>
Test if one number is greater than another.
clean loop [setc ycor fd 10 if ycor > 100 [stop]]
<
Test if one number is less than another.
clean repeat 1000 [if ycor < 100 [fd 1]]
=
Test if two numbers are equal.
clean repeat 500 [if heading = 180 [rt 180] fd 1 rt 1]
!=
Test if two numbers are not equal.
clean repeat 500 [ifelse heading != 180 [fd 1 rt 1] [rt 180]]
print
Print a value.
print color
print heading
make "list [10 20 30] print :list
wait
Wait for some time (in tenths of seconds).
clean repeat 100 [fd 5 rt 10 wait 1]
repeat
repeat times [list-of-commands]
Repeat the commands a specified number of times.
clean repeat 5 [fd 50 rt 72]
loop
Repeat the commands indefinitely.
clean loop [fd 50 rt 72]
press Command . to stop the loop
if
if condition [list-of-commands]
Conditionally run some commands.
clean
loop [setc ycor fd 10 if ycor > 100 [stop]]
ifelse
ifelse condition [commands-when-true][commands-when-false]
Conditionally run some commands if the results of the comparison is true, otherwise run the other list of comands.
clean
repeat 500 [ifelse heading != 180 [fd 1 rt 1] [rt 180]]
stop
Stop the program that is running.
clean
loop [setc ycor fd 10 if ycor > 100 [stop]]
output
Used to make a procedure to output a value
Type on the procedure area
to double :a
output :a * 2
end
then type on the command center
print double 37
run
run [ do-list-of-commands ]
Runs the list of commands.
run [fd 50 rt 90]
storeinbox
storeinbox1 value
storeinbox2 value
storeinbox3 value
Store a number in a box.
storeinbox1 10
print box1
storeinbox2 -15
print box2
seth 45 storeinbox3 heading + 10
print box3
box
The current value of a box.
storeinbox1 10
print box1
storeinbox2 -15
print box2
seth 45 storeinbox3 heading + 10
print box3
make
Sets a value to a variable.
make "a 10
print :a
to
Name a sequence of commands in the procedures area to create your own command.
to go
clean
repeat 5 [fd 50 rt 72]
end
sentence
Joins two values
storeinbox1 10
print se 30 box1
first
First of the list.
print first [1 2 3]
butfirst
All the elements of the list except the first.
Try
print bf [1 2 3]
last
Last element of the list.
print last [1 2 3]
butlast
All the elements of the list except the last.
print bl [1 2 3]
count
Number of elements of the list.
print count [1 2 3]
item
Element at the specified position on the list.
print item 2 [1 2 3]
nth
Element at the specified index on the list.
print nth 0 [1 2 3]
setnth
Set an item of a list to a value.
make "list [1 2 3]
setnth 1 :list 10
print :list
pick
Pick a random item from a list
make "colors [55 95 15] repeat 10 [setc pick :colors fd 15]