Page 155 - DCAP408_WEB_PROGRAMMING
P. 155

Unit 5: Scripting Language




          Output                                                                                Notes
          The number is 0
          The number is 1
          The number is 2

          Explanation: The loop will break when i=3.
                   }
                 </script>
                 </body>
                 </html>
          Output
          The number is 0
          The number is 1

          The number is 2
          Explanation: The loop will break when i=3.

          5.6.5 Continue

          The continue statement will break the current loop and continue with the next value.


                 Example: It is showing an example of continue.
                 <html>
                 <body>
                 <script  type=”text/javascript”>
                 var  i=0
                 for  (i=0;i<=10;i++)
                   {
                     if  (i==3)
                     {
                 continue;
                    }
                     document.write(“The  number  is”  +  i);
                     document.write(“<br  />”);
                   }
                 </script>
                 </body>
                 </html>
          Output
          The number is 0

          The number is 1



                                           LOVELY PROFESSIONAL UNIVERSITY                                   149
   150   151   152   153   154   155   156   157   158   159   160