Learning JS Course @Sololearn - Day29

·

1 min read

Today #day29 of #100daysofcode, I have completed 3.19,3.20 lessons and a practice program in JS. @Sololearn

The while loop

  • As long as the condition is true the while loop repeats the block of code.
  • syntax: while (condition) { code block}
  • the condition can be any conditional statement which returns true or false.

    Note:

  • while writing condition be careful with the conditional statement if it is true always then the loop will run forever.
  • make sure the conditional statement of a condition in while loop becomes false eventually.

The do... while loop

  • do while loop is a variant of the while loop but the main difference is 'the while loop' checks the condition before executing a block of code whereas 'the do... while loop' executes code of block and then checks condition and then it repeats until the conditional statement eventually becomes false.
  • syntax: do {code block} while (condition);

Images:

  • 5. day29 3.19 completed.png
  • 7. day29 3.20 completed.png

Conclusion

  • The while loop
  • The do... while loop
  • code
  • quiz

My Code:

  • 2. day29 prog prob.png

References Sololearn

Author: Dheeraj.y

Connect with me: