Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Elixir

Idiom #78 "do while" loop

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

def main(condition) do
  case condition do
    true -> main(condition)
    false -> nil
  end
end
loop
   stuff();
   if not c then
      exit;
   end if;
end loop;

New implementation...
< >
deleplace