While Loop
The while loop iterates the contents of the loop until the loop condition becomes false.
var n = 5;
Text1.text = "The factorial of " + n;
var fact = 1;
// -- Compute n!, where n is a non-negative integer
while (n > 1) {
fact = fact * n;
n = n -1;
}
Text1.text += " is " + fact;
Use the “break” command inside any loop to exit the loop, or use “continue” to skip to the next iteration.
| << For Loop | © 1996-2013 InetSoft Technology Corporation (v11.4) | Switch Statement >> |