Usage

Syntax: while (condition) { }

Explanation

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 this.foo equal to TRUE, then the loop will stop when this.foo is set to FALSE.

Example

this.counter = 0;

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

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

Categories

CategoryLanguageConstruct
Comments [Hide comments/form]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki