do statement

do statement Test-at-bottom loop statement

statement := do statement while ( expression ) ;

The do statement is a loop that executes statement, then tests expression. The loop iterates while expression is true and ends if expression is false. The loop body always executes at least once.

Example

do {

  cout << "Number: ";

  if (cin >> num)

    data.push_back(num);

} while(cin);

See Also

break, continue, expression, for, statement, while, Chapter 4