JS+Loops - while (condition) {} statements within { } get...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 170:JS Loops Prof. Jim Appenzeller speaker@rci.rutgers.edu
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
while loop Syntax: while (condition) { some statements; <increment;> } The code between { } gets executed for as long  as the condition is true and breaks out of the  loop when condition is false.
Background image of page 2
if versus while if (condition) } statements within { } get executed just once
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while (condition) {} statements within { } get executed as long as condition is true do loop Syntax: do { some statements; increment; } while (condition); Statements within { } get executed at least once. The condition decides whether the next iteration is to be performed or not....
View Full Document

Page1 / 4

JS+Loops - while (condition) {} statements within { } get...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online