While Loops

While Loops

A while loop has just a test. If the condition in the test is true the entire body of the loop executes, even if the condition becomes false inside the loop. When body of the loop ends, the test is made again. A while loop executes 0 or more times.

Please study the material at each of the links below.

  1. Compare for and while
  2. A loop to count
  3. Blast off 2 ways
  4. Doubling a value
  5. An endless loop
  6. Ending a total loop with a sentinel value
  7. Ending a total loop by asking if there are more
  8. Display "pass" or "fail" for each grade
  9. Finding the smallest and largest
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:26.