Below are some examples of recursion. I had been trying to replicate the spirals within the head of a sunflower!


The program used was:

TO SUNF :S :A
FD :S RT :A
SUNF :S + 1 :A
END

You might like to replicate the spirals above by considering suitable values for the variables :S and :A.

The real challenge is to simulate the head of a sunflower with more spirals that are much more tightly packed and look distinctly more 'Fibonacci' in proportion!

FIRST FORWARD

Beginners can start with FIRST FORWARD 1 to 7 here or go back and follow through the series month by month starting from the Introduction to LOGO in July 1999.

FIRST FORWARD 8

Consider the following procedure:

TO PATTERN :SIZE
REPEAT 5 [FORWARD :SIZE RT 144]
END

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:

PATTERN 30 PATTERN 60 PATTERN 120

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]
END

TO HEXAGON :S
REPEAT 6 [ FD :S RT 60]
END

TO DODECA :S
REPEAT 12 [BK :S LT 30]