Which loop in C++ tests the condition before executing its body?

  • do-while loop
  • for loop
  • switch loop
  • while loop
The while loop in C++ tests the condition before executing its body. It's a pre-test loop, meaning that it evaluates the condition first, and if it's true, it enters the loop body. This loop is suitable when you want to execute a block of code as long as a condition is true initially.
Add your answer
Loading...

Leave a comment

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