Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


4 Program Flow Control

A computer program often needs to repeatedly execute a series of statements or execute different statements according to the result of some decision. For example, a program to print all the numbers between one and a thousand would be very long and tedious to write if each print statement had to be given individually--it would be much better to use a variable and repeatedly print its value and increment it.

Another aspect of flow control is choosing between different pieces of code to execute. For instance, if something goes wrong a program may need to decide whether to continue or print an error message and stop--this part of a program is a typical example of a conditional block.


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.