Let i = 0;
do {
  alert( i );
} while (i < 3);

The condition check can be moved below the loop body using the do..while syntax.

The loop will first execute the body, then check the condition and, while it's truthy, execute it again and again.


Do {
  // loop body
} while (condition);

Related concepts


"do..while" — Structure map

Clickable & Draggable!

"do..while" — Related pages: