do while loops
Do...while sentinal loops.
they are postest, they often do not need the priming read that their while loop counterpart requires var guests=[]; var input; do{ input=window.prompt("Enter a guests name...(type quit to exit)"); //control var alteration guests.push(input); //places input at the end of guests }while(input!="quit"); document.write(guests)
A do...while loop
A do...while loop is a posttest iterative structure that can be used as a counting or sentinal loop. In general, a do...while loop looks like this: <control var intitialization> do{ <loop body> <control var alteration> (while(<loop condition>);
Do...while counting loop
var input; do{ input=window.prompt("Enter a number between 1 and 10, inclusive:"); }while(!(input>=1 && input <=10)); //continue with program