5.5. The while and do-while loops
[5.1] Create and use while loops
[5.3] Create and use do-while loops
You’ll learn about while and do-while loops in this section. Both of these loops execute a set of statements as long as their condition evaluates to true. Both of these loops work in the same manner except for one difference: the while loops checks its condition before evaluating its loop body, and the do-while loop checks its condition after executing the statements defined in its loop body.
Does this difference in behavior make a difference in their execution? Yes, it does, and in this section, you’ll see how.
5.5.1. The while loop
A while loop is used to repeatedly execute a set of statements as long ...