A Platform To Learn To Code


The break statement is used to break or jump out of the loop.

The continue statement is used to skip loop body executes for that iteration.

Let's see the flow diagram of both break and continue statements.

break statement tutorialstonight

Break statement flow diagram

continue statement tutorialstonight

continue statement flow diagram

The break statement

We have already seen the break statement when we were learning switch statement. break statement was used to jump out of switch statement.

switch statement is also used to jump out of loops. It is enclosed in a conditional statement and it is executed when the condition is true.

Here is an example of a break statement which jumps out of loop when count becomes 4.


Run the code

The continue statement

The continue statement is used to jump one iteration of the loop. It skips the execution of code for that iteration when it is executed.

In the example below continue statement runs when count is equal to 4, and skip the code below it without executing.


Run the code

The label statement

Javascript labelled code represents a block of code where the label name is used to identify the block of code.


        // Single or Multiple Code
        // Statements

A label name can be used to break or continue the block of code.

break label_name;

continue label_name;


Run the code