Revised: 10/01/98; 08/04/99; 01/20/00; 03/30/00; 07/12/02


CHAPTER 15 — Loops

Most modern machines work by endlessly repeating the same motions. The engine in your car cycles through the same motions over and over as it burns gasoline to provide power. Electric motors are similar. They convert electric power into spinning motion. Both of these machines are useful because they work continuously and can keep going as long as we want.

Computer programs can have cycles within them, also. In programming, a cycle is called a loop. When a program has a loop in it, some statements are done over and over as long as is needed to get the work done. Most computer programs execute many millions of program statements each time they are used. Usually the same statements are executed many times. This chapter discusses several kinds of programming loops.

Chapter Topics:

QUESTION 1:

Think of some machines (mechanical or other) that use cycles.