Break,Continue in JavaScript

Class -B.Com II year
Subject Type-OEL
Asst Prof. Manju Kumawat
The basic break statement consists of the keyword break followed by a semicolon. This form is used to exit the innermost enclosing whiledo-whilefor, or switch block immediately. 
  The syntax for the JavaScript continue statement is simply the keyword followed by a semicolon. An optional label can be used to control nested loops. 
Program-
<html>
<head>
<title>
Break and Continue Statement Example
</title>
</head>
<body>
<script>
i=0;
n=5;
while(i<=n)
{
i++;
if(i==2)
//continue;
break;
document.write("Numbers are:"+i);
document.write("<br/>");
}
</script>
<h>java script program</>
<p>continue and break statement</p>
</body>
</html>

0 comments:

Post a Comment