Skip to main content

// Dowhile

Do while 


  1.  <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <script type="text/javascript">
  9. // Dowhile 
  10. //print number 20 to 40 
  11.          var a = 20;

  12. do // the body of the loop is excuted at least once time.
  13. {
  14. document.write("the value of a is: "+a+"<br>"); // document.write() use for print line.
  15. a++;                                           //(a=20 <= 40) the condition is True; therefore execute                                                                    conditional code.
  16. }while(a <= 40)                                  //the condition is true; then control jumps to back 'do', and the loop again ececutes unitl then condition is false.
  17. </script>
  18. </body>
  19. </html>


//Execute


//Output

/*  

the value of a is: 20

the value of a is: 21

the value of a is: 22

the value of a is: 23

the value of a is: 24

the value of a is: 25

the value of a is: 26

the value of a is: 27

the value of a is: 28

the value of a is: 29

the value of a is: 30

the value of a is: 31

the value of a is: 32

the value of a is: 33

the value of a is: 34

the value of a is: 35

the value of a is: 36

the value of a is: 37

the value of a is: 38

the value of a is: 39

the value of a is: 40

 */


                                                                                                 //ThE ProFessoR