SLogo Basic Commands
Name | Description |
---|---|
SUM num1 num2
|
returns sum of num1 and num2 |
DIFFERENCE num1 num2
|
returns difference of num1 and num2 |
PRODUCT num1 num2
|
returns product of num1 and num2 |
QUOTIENT num1 num2
|
returns integer quotient of num1 and num2 |
REMAINDER num1 num2
|
returns integer remainder on dividing num1 by num2. The result is the same sign as num2 |
MINUS num
|
returns negative of num |
Command | Description |
---|---|
FORWARD dist
|
moves the turtle forward by dist pixels |
BACK dist
|
moves the turtle backwards by the amount specified |
LEFT degrees |
turns the turtle counterclockwise by the specified angle |
RIGHT degrees |
turns the turtle clockwise by the specified angle |
SETXY xcor ycor
|
moves the turtle to an absolute screen position. |
SETX xcor
|
moves the turtle horizontally to a new absolute horizontal coordinate |
SETY ycor
|
moves the turtle vertically to a new absolute vertical coordinate. |
HOME
|
moves the turtle to the center of the screen (0 0) |
XCOR
|
returns the turtle's X coordinate |
YCOR
|
returns the turtle's Y coordinate |
HEADING
|
returns the turtle's heading in degrees |
TOWARDS xcor ycor
|
returns a heading the turtle should be facing to point from its current position to the given position |
SHOWTURTLE |
makes the turtle visible |
HIDETURTLE |
makes the turtle invisible |
CLEAN
|
clears the drawing area (the turtle's statistics do not reset) |
CLEARSCREEN |
erases the drawing area and sends the turtle to the home position (Like CLEAN and HOME) |
PENDOWN |
sets the pen's position to DOWN |
PENUP |
sets the pen's position to UP |
PENDOWNP |
returns 1 (:TRUE) if the pen is down, 0 (:FALSE) if it's up. |
Command | Description |
---|---|
REPEAT numOrVar [ instructionlist
|
runs instructionlist numOrVar times |
IF varOrCommand [ instructionlist |
if varOrCommand is not 0, run instructionlist |
TO sub_name [ |
defines a new subroutine (command) named subr_name. When invoked, the subroutine will execute the body of instructions included in the definition. |
Command | Description |
---|---|
LESS? num1 num2
|
returns 1(:TRUE) if its first input is strictly less than its second, or 0 otherwise (:FALSE) |
GREATER? num1 num2
|
returns 1 if its first input is strictly greater than its second, or 0 otherwise |
EQUAL? thing1 thing2
|
returns 1 if the two inputs are equal, 0 otherwise |
NOTEQUAL? thing1 thing2
|
returns 1 if the two inputs are not equal, 0 otherwise |