6.2. Assessment: Writing Loops

Subgoals for Writing a Loop

  1. Determine purpose of loop

    1. Pick a loop structure (while, for, do_while)

  2. Define and initialize variables

  3. Determine termination condition

    1. Invert termination condition to continuation condition

  4. Write the loop body

    1. Update Loop Control Variable to reach termination

You have attempted of activities on this page