to ex1
rt 1
ex1
end
This procedure is recursive because the procedure ex1 is called on the last line. While executing,
we can see that the turtle turns on itself forever. To break the program, we must click on the STOP
button.
Here are three new primitives:
- wait number wait 60
Pause the program during the number of 60th seconds.
For example, wait 120 will pause the program for two seconds.
- penerase penerase
When the turtle moves, it erases all it encounters instead of drawing.
- penpaint penpaint
Returns to classic mode. The turtle draws lines when it moves.
to ex2
fd 200 penerase wait 60
bk 200 penpaint rt 6
ex2
end
Now, we can execute the program. On each second, the same procedure is repeated. We obtain the seconds of a
clock!