Hosting Solutions
mobile_logo Table of Contents

do while

The do...while statement is an inverted while statement. It will execute code as long as the condition returns a value of true. In contrast to other loops the first iteration of the do...while loop is always guaranteed to run due to the condition evaluation being at the bottom.

Syntaxdo { // execute code } while ( true );
var i = 0; do { document.write("Loop index: "+i+"<br>"); i++; } while ( i < 5 );



breakconstcontinuedo whileforfor inif elselabelreturnswitchtry catchvarwhilewith