Copyright © University of Cambridge. All rights reserved.
First Forward Into Logo
Previous: FF11
In FF9 you looked at several different sequences of numbers.
Here are more programs that generate sequences.
Now consider the following procedures.
TO SUMO :X :N
PR :X
WAIT 120
SUMO :X + :N :N + 2
END
What do you think is happening this time?
Try 'chasing' through the procedure the values: x= 1 and n = 1.
The output from this program is given on the right.
Now why not experiment further by changing the fourth line?
For example:
TO SUMO :X :N
PR :X
WAIT 120
SUMO :X + :N :N + 3
END
Or
SUMO :X * :N :N  3
SUMO :X + :N * 2 :N + 1
SUMO :X  :N :N + 3 Etc
Any surprises?

1
2
5
10
17
26
37
50
65
82
101
122
stopped
in SUMO
2
6
8
8
6
2
4
12
22
34
48
stopped
in SUMO
