while

Executes a statement while the specified expression is true.

Syntax

 while (expression)
statement 

Example

 n = 0;
  while (n < 3) {
  n ++;
  doSomething(); //Will "doSomething" three times--until n is no longer less than three.
} 

Remarks

Use a while loop as a shorthand version of a "counter" for loop.

text_javascript aptana_docs