Repeating commands

Sometimes you will want PIP to carry out a list of commands several times. For example you can make PIP move around a square by pressing:-

PIP 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 PIP when to stop repeating.

We can repeat groups of commands that are to be repeated. So, to move in a square three times press:-

PIP 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 PIP will grumble at you when it runs the program and finds the mistake.

PIP will grumble if you try and "nest" 's too deeply.