I l@ve RuBoard Previous Section Next Section

Chapter 6. Decision and Control Statements

Once a decision was made, I did not worry about it afterward.

—Harry Truman

Calculations and expressions are only a small part of computer programming. Decision and control statements also are needed, to specify the order in which statements are to be executed.

So far you have constructed linear programs, which are programs that execute in a straight line, one statement after another. In this chapter you will see how to change the control flow of a program with branching statements and looping statements . Branching statements cause one section of code to be executed or not, depending on a conditional clause. Looping statements are used to repeat a section of code a number of times or until some condition occurs.

    I l@ve RuBoard Previous Section Next Section