Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

continue Statement

Stops the current iteration of a loop, and starts a new iteration.

continue [label];

Arguments

label
Optional. Specifies the statement to which continue applies.

Remarks

You can use the continue statement inside while, do...while, for, or for...in loops only. Executing the continue statement stops the current iteration of the loop and continues program flow with the beginning of the loop. This has the following effects on the different types of loops:

  • while and do...while loops test their condition, and if true, execute the loop again.
  • for loops execute their increment expression, and if the test expression is true, execute the loop again.
  • for...in loops proceed to the next field of the specified variable and execute the loop again.

Example

The following example illustrates the use of the continue statement.

function skip5(){
   var s = "", i=0;
   while (i < 10) {
      i++;
      // Skip 5
      if (i==5) {
         continue;
      }
      s += i;
   }
   return(s);
}

Requirements

Version 1

See Also

break Statement | do...while Statement | for Statement | for...in Statement | Labeled Statement | while Statement

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.