In Association with Amazon.in   Flipkart

Saturday, August 10, 2013

JavaScript Continue Statement In For Loop Example

Continue Statement: To Break The Loop temporarily if certain condition is true and re-continue again.

Example:

<body>
    <script>


    // Break in  For Loop


    t=9;


    for(i=1; i<=12; i++)
    {
        if(i%3==0)
            continue;
        document.write("<br/>" + t+ " X " + i + " = " + i*t);   
    }
   
    </script>
</body>


Output:

9 X 1 = 9
9 X 2 = 18
9 X 4 = 36
9 X 5 = 45
9 X 7 = 63
9 X 8 = 72
9 X 10 = 90
9 X 11 = 99

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...