while (condition) statementand executes the statement as long as the condition expression is not zero.
The condition is tested before the first possible execution of statement, which means that the statement may never be executed if condition is initially zero.
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 = 0; while (s[i]) ++i;
|Index||Copyright © 2005 CadSoft Computer GmbH|