Logo

Programming-Idioms

  • Python
  • C#

Idiom #78 "do while" loop

Execute a block once, then execute it again as long as boolean condition c is true.

do
{
    stuff();
} while(c);
x = True
while x:
    x = c

Python does not have a `do-while` loop syntax.
while True:
    do_something()
    if not c:
        break
loop
   stuff();
   if not c then
      exit;
   end if;
end loop;

New implementation...
< >
deleplace