JAVASCRIPT

 Home  Computers & Internet  Web Programming JAVASCRIPT
What is Javascript?
Javascript Placement
Syntax
Reserved Words
Variables
Data Types
Escaping Characters
Concatenation
Arithmetic Operators
Assignment Operators
Comparison Operators
Boolean Operators
Conditional Operator
If Statements
Else If Statements
If Else Statements
Switch Statements
While Loops
For Loops
Do While Loops
Break Statement
Continue Statement
prompt()
alert()
Date()
Event Handlers
String Object Methods
Math Object Methods
Window Object Methods

JAVASCRIPT CONTINUE STATEMENT

The continue statement is used to only stop the code following the continue word from executing if a certain test condition is met, but further looping occurs until the loop ends naturally.

Example Without Continue:

i=0;

while(i < 10)
{
i++;
document.write(i + "<br>");
}

The above will output numbers 1 through to 10 and the loop ends naturally.

Example With Continue:

i=0;

while(i < 10)
{
i++;
if(i==4) continue;
document.write(i + "<br>");
}

The above will output numbers 1 through to 10 but not number 4. We are telling the loop to stop iterating (ie. executing the code after the word continue which in our case is document.write(i + "<br>");) when test condition of i==4 is met but still continue with the looping on the whole.

Home | Privacy Policy | Terms Of Use | Contact Us