Mastery22:: When to use what type of repetition in a program

http://www.cs.fsu.edu/~cop3014p/lectures/ch5/index.html)

 

Two types of repetition structures: pretest and posttest loops

Pretest:

  1. Loop condition appears at beginning of pretest loop
  2. Determines number of times instructions w/in loop body are processed


Types of pretest loop:

  • while
  • for

Posttest:

  1. Loop condition appears at end of posttest loop
  2. Determines number of times instructions w/in loop body are processed
  3. HOWEVER, instructions processed at least once–the first time

1017

EXAMPLE!!!

CC BY 4.0 Mastery22:: When to use what type of repetition in a program by Carolina Romo is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.