Commands of ALPLogo programming environment
Number |
Format of the command |
Command explanation and example |
1 |
backward n |
Turtle
moves back by n dots(pixels). backward 50 |
2 |
break |
Used to
exit the cycle repeat, without
waiting for the completion of the cycle. variable x x = 0 pendown repeat 1000 [ forward
x right 90 x = x + 10 if
(x> 350) [ break ] ] |
3 |
clean |
Clears
working area. clean |
4 |
forward n |
Turtle
moves forward by n
dots (pixels). forward 100 |
5 |
go x, y |
Turtle
goes to point with coordinates
(x, y). go
200, 300 |
6 |
hideturtle |
The
command hides the turtle on the screen. hideturtle |
7 |
home |
This
command returns the turtle center
of the screen and set so that its
head is facing up. home |
8 |
if
(condition)
[command1] else [command2] |
If
the condition
is true, then run command
group command1,
otherwise run
command group command2. if
(c1 <c2)
[write
"c1 is less"] else
[write
"c1 is no less"] In
some cases there is no
requirement to use else
command (you do not need to use
part else). |
9 |
left n |
Turtle
turns left on n
degrees. left
60 |
10 |
music m, s |
Playing
a melody m
at a speed of s. music
cücələrim.alm,
80 |
11 |
musicstop |
Stops playing the melody. music
cücələrim.alm, 80 wait
2000 musicstop |
12 |
paint x, y |
The screen
is painted in the appropriate
color, starting from the point
with coordinates x, y. If the screen has
figures, then the closed area
of them do not change color. go
200, 200 pendown // draw square repeat
4 [
forward
100 right
90 ] pencolor
4 // paint square paint
250, 150 |
13 |
pencolor r |
Selects
pen color r.
Here, the variable r
can take values from 0 to 15. pencolor 4 |
14 |
pendown |
Turtle
puts pen to keep track
of when it move. pendown |
15 |
penup |
Turtle
raises the pen, not to leave
a trail when moving. penup |
16 |
penwidth n |
Turtle
uses the pen thickness n. penwidth 3 |
17 |
random(n) |
Generate a random integer in range 0 to
n-1. write random(100) |
18 |
repeat n
[commands] |
command
in brackets [] are repeated n
times. repeat
4 [forward
100 right
90] |
19 |
right n |
Turtle
turns right by n degrees. right
90 |
20 |
screenH |
System
variable indicating the height of the screen (the
number of vertical pixels). This variable is not declared in the
program. write screenH |
21 |
screenW |
System
variable indicating the width of the screen (the
number of horizontal pixels).
This variable is not declared in the program. write screenW |
22 |
showturtle |
Command
displays the turtle on the screen. showturtle |
23 |
subroutine abc
(x, y) |
Specifies
the helper program (subroutine) that is called
from main program. For example: subroutine
square (a) [
repeat
4 [forward
a right
90] ] This
subroutine builds a square with part equals a.
For the construction of squares with a
side of 80 and 100 is sufficient to write in the
main program: square
(80) square
(100) |
24 |
textsize n |
Specifies
the text font size n
points, where n
- integer. textsize
n |
25 |
turtleX |
System
variable indicating the current X coordinate of Turtle (across the screen
width). This variable is not declared in the
program. write turtleX |
26 |
turtleY |
System
variable indicating the current Y coordinate of Turtle (across the screen
height). This variable is not declared in the
program. write turtleY |
27 |
variable x |
It declares
a variable x. variable
a, b declares
two variables a and b. For setting
the variable value it uses the sign assignment. a = 5 b = a + 1 |
28 |
wait x |
Pauses execution
of commands by x milliseconds. forward 100 wait 1000 forward 200 |
29 |
write x |
Writes
indicated value of x
in the operating field. For writing string
characters it needs to be described
in quotes. variable
a a = "Hello" write
a write
"Hello" |
30 |
// |
The text following these characters is perceived as a comment. Unlike other commands comments do not run. // draw square |
Note |
In the area code by
using the keyboard shortcut CTRL + SPACE (CTRL + Spacebar), you can open a list of commands and using ready-made commands, accelerate the coding. |