Do while :- genius student


  • The do..while loop is similar to the while loop.
  • Loop continuously execute until given condition is false.
  • The loop code block execute at least once even the condition is false.
  • Syntax
    do {
        //code block to be executed
    }
    while(condition);

  • Code:-

  • <!DOCTYPE html> 
    1. <html> 
    2.  
    3. <head> 
    4.  <meta name="viewport" content="width=device-width, initial-scale=1"> 
    5. </head> 
    6.  
    7. <body> 
    8.  
    9.  <input type="button" onclick="fun_dowhile()" value="Execute do..while loop"> 
    10.  
    11.  <script> 
    12.   function fun_dowhile() 
    13.   { 
    14.    var i = 0; 
    15.    //inside the statement execute at least once 
    16.    do { 
    17.     alert(i); 
    18.     i++; //increment 1 with i value 
    19.    } while (0 == 3); 
    20.  
    21.   } 
    22.  </script> 
    23.  
    24. </body> 
    25.  
    26. </html>
    Do while :- genius student Do while :- genius student Reviewed by Network security on October 18, 2019 Rating: 5

    No comments:

    Useful Information

    Powered by Blogger.