March 2018
Intermediate to advanced
183 pages
2h 34m
English
There are three looping structures available in C++, all of which are used to execute a specific code block multiple times. Just as with the conditional if statement, the curly brackets for the loops can be left out if there is only one statement in the code block.
The while loop runs through the code block only if its condition is true and will continue looping for as long as the condition remains true. Bear in mind that the condition is only checked at the start of each iteration (loop).
The do-while loop works ...