Consider a scenario where a loop is expected to run based on an external condition (like an external input). Which loop is most appropriate for this scenario?

  • do-while loop
  • for loop
  • foreach loop
  • while loop
In scenarios where a loop's execution depends on an external condition, the while loop is most appropriate. It evaluates the condition before each iteration, allowing you to control the loop based on changing external conditions.
Add your answer
Loading...

Leave a comment

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