The do...while statement has the general syntax
do statement while (condition);
and executes the statement until the condition expression becomes zero.

The condition is tested after the first execution of statement, which means that the statement is always executed at least one time.

If there is no break or return inside the statement, the statement must affect the value of the condition, or condition itself must change during evaluation in order to avoid an endless loop.


string s = "Trust no one!";
int i = -1;
do {
   } while (s[i]);

Index Copyright © 2005 CadSoft Computer GmbH