Basics
Challenges
Classes
Debugging
Events
External Files
Flow Control
Forms
Functions
Html Elements
Installation
Interfaces
Keywords
Modules
Namespaces
Operators
Reference Files
String
Types
The break
statement "jumps out" of a loop or a conditional test such as a switch/case
statement.
// Example 1
let text: string = "";
for (let i: number = 0; i < 10; i++)
{
if (i===3)
{
break;
}
text +="The number is " + i + "<br />";
}
$("#demo1").html(text);
// Example 2 - will stop testing after break is hit.
switch(expression)
{
case n:
//code block
break;
case n:
//code block
break;
default:
//default code block
break:
}