Revisions: 08/24/01; 10/08/04 format changes

CHAPTER 6—Loops

Many machines do their work by using repeated motions, cycles. The engine in your car performs the same motions over and over again 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 do the same things over and over and can keep going as long as we want.

Computer programs, also, use cycles. Much of the usefulness of computer software comes from doing things in cycles. In programming, cycles are called loops. 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 millions of program statements each time they are used. Most of these statements are the same statements being executed over and over many times. This chapter discusses loops in QBasic.

Chapter Topics:

QUESTION 1:

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