do...while Statements

do...while statements repeat until a specified condition evaluates to false.

do {
  statement
} while (condition)

The statement executes once before the condition is evaluated. If the condition returns true, the statement executes again. At the end of every execution, the condition is evaluated. When the condition returns false, execution of the statement stops, and the statement following do...while executes.

Example—do...while statement that iterates at least once and reiterates until it is greater than five:

do {
  i+=1;
  Console.Writeln(i);
} while (i<5);