The ZX80 Operating Manual

Sinclair ZX Spectrum
DECISIONS, DECISIONS
So far we have only considered problems which can be solved by carrying out a list of instructions, starting at the beginning of the list and working steadily down the list until the last instruction is carried out.

The next four chapters deal with ways in which you can make the ZX-80 (or any computer using BASIC) carry out much more complex programs which can perform many tedious tasks.

In chapter 5 we talked briefly of the use of flowcharts for checking that the program steps were in a logical sequence. This can be useful even for simple programs. When it comes to complex programs flowcharts are vital.

Let's consider a problem we face every day — getting up in the morning. There is a flowchart for getting up below.

The program is said to branch at each decision diamond. As you can see, one feature of branches is that they allow some parts of the program to be skipped if they are not neccessary.

Programs can get difficult to understand if there are a lot of branches, and this is where flow diagrams help.

It is a good idea to keep a pad or notebook handy when you are writing programs and an even better one to draw a flow diagram of your program before you start writing it!

Turn to the next chapter to find out how the ZX-80 can take decisions.

GETTING UP


Sinclair ZX Spectrum

  Previous Page Back Next Page