Add the text "In addition to the break statement which opts out of th… (#26063)
* Add the text "In addition to the break statement which opts out of the iteration when the condition is false is the continue statement. The `continue` statement skips the condition when the code is true, continues up until the condition is false. Using the above example again, let's see the functionality of the `continue` statement ```javascript for (var elephant = 1; elephant < 10; elephant+=2) { if (elephant === 7) { continue; } console.info('elephant is ' + elephant); } output: elephant is 1 elephant is 3 elephant is 5 elephant is 9 ```" to article * Improved sentence structure
This commit is contained in:
committed by
Manish Giri
parent
697c040a66
commit
14b29da497
@ -80,5 +80,25 @@ elephant is 3
|
|||||||
elephant is 5
|
elephant is 5
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In contrast to the `break` statement which opts out of the iteration when the condition is false, the `continue` statement skips the condition when the code is true, and continues up until the condition is false.
|
||||||
|
|
||||||
|
Using the above example again, let's see the functionality of the `continue` statement
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
for (var elephant = 1; elephant < 10; elephant+=2) {
|
||||||
|
if (elephant === 7) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
console.info('elephant is ' + elephant);
|
||||||
|
}
|
||||||
|
|
||||||
|
output:
|
||||||
|
elephant is 1
|
||||||
|
elephant is 3
|
||||||
|
elephant is 5
|
||||||
|
elephant is 9
|
||||||
|
```
|
||||||
|
|
||||||
### Other Resources
|
### Other Resources
|
||||||
* [MDN - for statements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)
|
* [MDN - for statements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)
|
||||||
|
Reference in New Issue
Block a user