A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/statements/continue below:

continue · WebPlatform Docs

continue Summary

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

Syntax
continue [ label ];
Examples

In this example, a loop iterates from 1 through 9. The statements between continue and the end of the for body are skipped because of the use of the continue statement together with the expression (i < 5).

for (var i = 1; i < 10; i++) {
     if (i < 5) {
         continue;
     }
     document.write (i);
     document.write (" ");
 }

 

In the following code, the continue statement refers to the for loop that is preceded by the Inner: label. When j is 24, the continue statement causes that for loop to go to the next iteration. The numbers 21 through 23 and 25 through 30 print on each line.

Outer:
 for (var i = 1; i <= 10; i++) {
     document.write ("<br />");
     document.write ("i: " + i);
     document.write (" j: ");

 Inner:
     for (var j = 21; j <= 30; j++) {
         if (j == 24) {
              continue Inner;
         }
         document.write (j + " ");
     }
 }

 
 
 
 
 
 
 
 
 
 
 
Remarks

The optional label argument specifies the statement to which continue applies.

You can use the continue statement only inside a while , do…while , for , or for…in loop. 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:

See also Other articles Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4