0% found this document useful (0 votes)
34 views1 page

The Break Statement

The break statement is used to exit a loop early, breaking out of the enclosing curly braces. It can be used to jump out of a loop, breaking the loop and continuing execution of code after the loop. An example shows using a break statement in a while loop to stop iterating when the counter reaches 5.

Uploaded by

rina mahure
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

The Break Statement

The break statement is used to exit a loop early, breaking out of the enclosing curly braces. It can be used to jump out of a loop, breaking the loop and continuing execution of code after the loop. An example shows using a break statement in a while loop to stop iterating when the counter reaches 5.

Uploaded by

rina mahure
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

The break Statement:

The break statement, which was briefly introduced with the switch statement, is used to exit a loop
early, breaking out of the enclosing curly braces

The break statement can also be used to jump out of a loop.  

The break statement breaks the loop and continues executing the code after the loop (if any)

Example:
<html>
<head><title></title>
<script language="javascript">
var i=1
document.write("Implementation of break statement <br>")
while (i<10)
{
document.write(i+" ")
if(i==5)
{
break
}
i=i+1
}
</script>
</head>
<body>
</body>
</html>
Output:
Implementation of break statement
12345

You might also like