Sometimes you will want PIPPIN to carry out a list of commands several times. For example you can make PIPPIN move around a square by pressing:-
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
PIPPIN can make the same movements if you tell it to repeat forwards 10 centimetres and turn right 90 degrees four times. This is the program:-
|
|
|
|||||
|
|
|
|
|
|
||
|
|
stands for RePeaT. The key needs to be followed by
the number of times the commands are to be repeated. The list of
commands to be repeated must be followed by the
key. Each
needs a matching
to tell PIPPIN when to stop
repeating.
We can repeat groups of commands that are to be repeated. So, to move in a square three times press:-
|
|
|
|||||
|
|
||||||
|
|
|
|
|
|
||
|
|||||||
|
|
PIPPIN can use a
inside
a sequence, inside a
sequence, but it cannot "nest" any deeper than
this.
There must be a matching
for every
, or PIPPIN will grumble at
you when it runs the program and finds the mistake.
PIPPIN will grumble if you
try and "nest"
's too deeply