Page 6 - Class 4 Computer Synopsis (LOGO Procedure)
P. 6
SAVING WORK IN MSW LOGO:
A procedure is saved temporarily when it is written or edited and run. In order to save it for later use, the
procedure has to be saved by typing Save along with procedure name and press Enter key. For example,
SAVE ''SQUARE.
LOADING A PROCEDURE: A saved procedure can be reused anytime using the LOAD command. We can
do this by writing LOAD and the name of the procedure in the Input box and pressing Enter key. For
example, LOAD ''SQUARE.
ERASING A PROCEDURE: If you want to erase a procedure then type ERASE and the procedure name
and press Enter key. For example, ERASE ''SQUARE.
REPEAT COMMAND:
As we have seen earlier, to draw a particular drawing, we have to repeat the same commands again and
again. In order to avoid repetition, LOGO has a REPEAT command. It is used to run the same instructions
repeatedly. Using REPEAT, we write primitives in one line, instead of writing them in a number of lines for
drawing any figure.
Type Repeat, followed by the number of times required to repeat the instructions list, and then the Logo
primitives, which are to be repeated.
For example: Repeat<number> [command]
To make a square we have to enter the following primitives
FD 100
RT 90
FD 100
RT 90
FD 100
RT 90
FD 100
RT 90
Here we are repeating the same primitives i.e. FD 100 and then RT 90 for 4 times. So instead of writing a
long set of procedure we can write: Repeat 4 [FD 100 RT 90] and press enter. Then LOGO will repeat the
command FD 100 and RT 90 for 4 times which will make a square then.
You can draw a triangle using the repeat command i.e. Repeat 3 [RT 120 FD 50] or a hexagon Repeat 6
[ FD 50 RT 60] or a pentagon with Repeat 5 [RT 72 FD 100].
To draw a specific side of polygon you have to divide 360 by no of turns to get the exact amount of RT or LT
turn required to make the polygon. For example, in triangle we have 3 sides so the no of repeats will be 3
but to calculate the no of degrees we have to divide 360 by 3 so 360/3 = 120 so the RT or LT will be 120 so
the command will be Repeat 3 [RT 120 FD 100] whereas, FD steps denotes the size of the triangle to make
a big triangle increase the no of steps for FD for smaller decrease the steps of FD. Similarly, to draw an
octagon with 8 sides we have to divide 360 by 8 so 360/8 = 45 so the command will be Repeat 8 [RT 45
FD 100]. To draw a decagon with 10 sides we have to divide 360 by 10 so 360/10 = 36 so the command
will be Repeat 10 [RT 36 FD 100].