The do-while loop

Estimated reading: 1 minute 46 views

This is almost exactly the same as the while loop, except for the fact that the loop’s body is executed at least once before the condition is tested.

				
					 do [loopBody] while ([conditional])

				
			

Here’s a do-while loop: Ado-while loop

				
					 do {
 // Even though the condition evaluates to false
 // this loop’s body will still execute once.
 alert(’Hi there!’);
 } while (false);
				
			
Share this Doc

The do-while loop

Or copy link