Continue Statement
Example
<script type="text/javascript">
var i=0
for(i=0;i<=5;i++)
{
if (i==2)
{
continue;
}
document.write("The number i = " +i);
document.write("<br />");
}
</script>
Output
The number i = 0The number i = 1
The number i = 3
The number i = 4
The number i = 5
When variable ‘i’ is exactly 5, we don’t want to execute the code, after that we want to execute the code.
Here we see that “i=2” is terminated or skipped.
No comments:
Post a Comment