Table of Contents
Previous Section Next Section

do

The do loop is one of three loop constructs available in C++. The general form of the do loop is

do {
     statement block
} while(condition);

If only one statement is repeated, the braces are not necessary, but they add clarity to the statement.

The do loop is the only loop in C/C++ that will always have at least one iteration because the condition is tested at the bottom of the loop.


Table of Contents
Previous Section Next Section