Copyright © University of Cambridge. All rights reserved.
You might like to learn some more Logo by going to Muggles, Logo and Gradients where you will use Logo to throw light on a very puzzling problem called Muggles Magic .
Consider the following procedure:
TO PATTERN :SIZE
REPEAT 5 [FORWARD :SIZE RT 144]
What is different about this procedure?
Did you notice :SIZE ?
It is called a VARIABLE .
It is always written in a particular way using a colon.
What do you think this is about?
What does the word variable suggest to you?
Why not type in the procedure above and then copy the following:
Or experiment with different numbers for yourself and see what patterns you can produce.
Are you feeling happier with the idea of a variable? If so why not explore further this idea of using a variable in those procedures you have met previously.
TO SQUARE :SIZE
REPEAT 4 [ FD :SIZE RT 90]
TO HEXAGON :S
REPEAT 6 [ FD :S RT 60]
TO DODECA :S
REPEAT 12 [BK :S LT 30]