Executes a statement until a specified condition is false.
|
---|
while (expression)
statement |
Arguments
- expression
-
Required. A Boolean expression checked before each iteration of the loop. If expression is true, the loop is executed. If expression is false, the loop is terminated.
- statement
-
Required. Statement to be executed if expression is true. Can be a compound statement.
Remarks
Example
The following example illustrates the use of the while statement.
В | Copy Code |
---|
function BreakTest(breakpoint){
var i = 0;
while (i < 100) {
if (i == breakpoint)
break;
i++;
}
return(i);
} |
Requirements
See Also