Which of the following loops will always execute its code block at least once?

  • do-while loop
  • for loop
  • if statement
  • while loop
The do-while loop is designed to execute its code block at least once, as it checks the condition after executing the loop body. This is useful when you want to ensure that a piece of code runs before checking the condition for termination.
Add your answer
Loading...

Leave a comment

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