Basics

Challenges

Classes

Cookies

Debugging

Events

External Files

Flow Control

Forms

Functions

Html Elements

Installation

Interfaces

Keywords

Modules

Namespaces

Operators

Reference Files

String

Types

TypeScript - Continue

The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop. This example skips the value of 3.




function ContinueExample(): void
{
    let output: string = "";
    let demo1: HTMLElement = document.getElementById("demo1");

    for (let i: number = 0; i < 6; i++)
    {
        if (i===3)
        {
            output += `skipped! <br />`;
            continue;
        }
        output +=`The number is ${i} <br />`;
    }
    demo1.innerHTML = output;
}