next up previous
Next: Operators Up: JavaScript Control Statements Previous: for loops

While statement

The basic syntax is:

while(boolean condition)

For example:

var cond = false;

while(cond == false) {
  // do something
if(something happens) {
   cond = true;
}

// more processing
}

What happens if you want to be able to leap out of the middle of a loop?

or



Dave Marshall
9/28/2001