# Sequencing in practice: Drawing a square

An to get a computer to draw a square on the screen might consist of these steps:

1. draw a 3 cm line
2. turn left 90 degrees
3. draw a 3 cm line
4. turn left 90 degrees
5. draw a 3 cm line
6. turn left 90 degrees
7. draw a 3 cm line

The steps in this algorithm are in the correct . This algorithm would result in a perfect square:

If there was a mistake when designing the algorithm, and the steps in this sequence were placed like this:

1. draw a 3 cm line
2. turn left 90 degrees
3. draw a 3 cm line
4. turn left 90 degrees
5. draw a 3 cm line
6. draw a 3 cm line
7. turn left 90 degrees

This algorithm would create this shape, rather than a perfect square:

Because step 6 is in the wrong sequence (it should switch with step 7), this algorithm failed. However, fixing the algorithm - and the square - is easy, because there are only seven steps to look through for the error.

Complex algorithms may have hundreds, if not thousands, of steps. It is critical to make sure all steps in the algorithm are in the correct sequence before programming begins. Once programmed, trying to find an instruction in the wrong sequence can be extremely difficult.