Chapter 8: Repetition


8.1 Introduction

Most practical algorithms require a group of operations to be carried out several times. The repetition design structure is a looping structure in which a specified condition determines the number of times the group of operations will be carried out. This group of operations is called a repetition group.

There are three variations of the repetition structure, and most programming languages include them. This chapter explains three constructs to apply the three variations of the repetition structure. The constructs for repetition are:

  1. While loop

  2. Loop until

  3. For loop

The first construct, the while loop, is the most general one. The other two repetition constructs can be expressed with the while loop.




Object-Oriented Programming(c) From Problem Solving to Java
Object-Oriented Programming (From Problem Solving to JAVA) (Charles River Media Programming)
ISBN: 1584502878
EAN: 2147483647
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net