The do loop

do Loops

A do loop has the test at the end. If the condition in the test is true the entire body of the loop executes again. A do loop always executes at least once, or 1 or more times.

The most common uses for a do loop is to say "Do you want to play again?" after executing the code once, and to force the user to enter a valid answer.

Please study the material at each of the links below.

  1. Counting
  2. Using a do loop to force a valid response
Like us on Facebook:


OER: Open Educational Resource
Creative Commons License Author: Janet E. Joy; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: May 23 2017 17:41:25.