Thursday, June 6, 2024

While Loop

 

The while loop loops through a block of code as long as a specified condition is true.


<script> /*Increase While Loop Condition */ var a = 1; while (a <= 10) { document.write(a + ") Hello Yahoo Baba <br>"); a = a + 1; } /* Decrease While Loop Condition */ var x = 10; while (x >= 1) { document.write(x + ") Hello Yahoo Baba <br>"); x = x - 1; } </script>

 

No comments:

Post a Comment