do while loops

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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


Set pelajaran terkait

FTCE Elementary Education K-6 Math

View Set

Homophones, Homonyms and homographs

View Set

Jupiter and the Galilean Moons Section

View Set

UNIT EXAM ONE- American Government

View Set