contents   index   previous   next

do {...} while


The do statement is different from the while statement in that the code block is executed at least once, before the test condition is checked.


var value = 0;





} while( value < 100 );


The code used to demonstrate the while statement could also be written as the following fragment.




   var name = GetNameFromTheList();


} while (name != TheLastNameOnTheList());


Of course, if there are no names on the list, the script will run into problems!