Lecture+14+-+JS+Loops+1

Lecture+14+-+JS+Loops+1 - CS170Lecture14 JSLoopspart1...

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

View Full Document Right Arrow Icon
CS 170 Lecture 14 JS Loops part 1 Kristian Stout stouty@rci.rutgers.edu Office IN: Livingston Student Center, A lounge near “the rock” and the commuter lounge. Office Hours: TTH 5:30 – 6:30
Background image of page 1

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

View Full DocumentRight Arrow Icon
Why do we need loops? Loops enable us to run a set of computations many  times Examples Printing out ‘n’ numbers If a wrong username/password is entered, keep  asking for correct one. waiting for something to happen Asking someone if they’d like to do more than one  thing on a site.
Background image of page 2
Loops Loops are used to repeat a block of code we call this “iterating” or “iteration” Loops are used to repeat a block of code a specified  number of times while a specified condition is true  There are three primary types:  while do  and  for
Background image of page 3

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

View Full DocumentRight Arrow Icon
Essentials for a loop An iteration variable of some sort is needed eg  var i; Starting point  / initial conditions  
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/17/2011 for the course BUSINESS 198:170 taught by Professor Staff during the Spring '09 term at Rutgers.

Page1 / 29

Lecture+14+-+JS+Loops+1 - CS170Lecture14 JSLoopspart1...

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

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