Which control structure is best suited to execute a block of code at least once, and then based on a condition, decide whether to continue executing?

  • do-while loop
  • for loop
  • if-else statement
  • switch statement
The do-while loop is well-suited for situations where you want to execute a block of code at least once and then, based on a condition, decide whether to continue executing. It ensures that the code inside the loop is executed at least once, unlike the while loop, which may not execute if the condition is initially false.
Add your answer
Loading...

Leave a comment

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