Syntax: while (condition) { }


while produces a loop that repeats while the given condition is TRUE or until the loop limit is hit. This can be used to repeat a block of code as many times as needed.

You can end the loop's execution either by using break, return or by making the condition FALSE. For instance, if your condition is equal to TRUE, then the loop will stop when is set to FALSE.


this.counter = 0;

while (this.counter < 10)
  this.counter ++;

... will run 10 times until this.counter is equal to 10.



There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki