First another gentle reminder of the primitives:
| FD forward | BK backward | |
| LT left | RT right | |
| PU pen up | PD pen down | |
| HT hide turtle | ST show turtle | |
| CS clear screen | CT clear text |
One essential primitive not included so far is the REPEAT command, which has no abbreviation.
e.g. REPEAT 4 [FD 40 RT 90]
(Note the use of square brackets)
Perhaps this appears self explanatory to you?
Without doubt it is a more convenient way of coding the following instructions:
| FD 40 RT 90 | |
| FD 40 RT 90 | |
| FD 40 RT 90 | |
| FD 40 RT 90 | |
| Or | FD 40 RT 90 FD 40 RT 90 FD 40 RT 90 FD 40 RT 90 |
Either of the above sets of commands can be written:- REPEAT 4 [ FD 40 RT 90]
You might like to IMAGINE the following instructions:-
REPEAT 5 [FD 30 RT 72]
REPEAT 5 [FD 30 RT 144]
What about the following:
REPEAT 5 [FD 30 RT 216]
REPEAT 5 [FD 30 RT 288]
Imagine first; think the command through, perhaps make a sketch before testing out on your machine what you have 'seen' with your mind's eye.
Using the 'REPEAT' command allows procedures to be constructed more succinctly.