Which looping statement is suitable when the number of iterations is not known beforehand?

  • for loop
  • while loop
  • do...while loop
  • forEach loop
A while loop is suitable when the number of iterations is not known beforehand. It allows you to repeat a block of code as long as a specified condition is true. This makes it a flexible choice for situations where the loop's exit condition isn't predetermined.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *