break statement consists of the keyword break followed by a semicolon. This form is used to exit the innermost enclosing while, do-while, for, or switch block immediately. continue statement is simply the keyword followed by a semicolon. An optional label can be used to control nested loops. <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