keyword do
From Cppwiki
- This page is a stub. Please feel free to expand it. (list of stubs)
The do keyword beings a do-while loop. Unlike a while loop, a do-while loop executes its body statement at least once.
Example:
bool bQuit = false; do { char ch; if(!std::cin >> ch) { bQuit = true; }
if(ch == 'Q' || ch == 'q') { bQuit = true; }
switch(ch) { /* handle other input */ } } while(!bQuit);
Note that the trailing ';' after the while is a required part of the syntax.