For any case where you need the instructions within the loop to execute at least once, regardless of the while condition.
A common contrived example is continuously asking for valid user input. My condition to check if the input is valid would be within the while, however I need the request for input to execute at least once before checking the condition, so I use a do...while.
For any case where you need the instructions within the loop to execute at least once, regardless of the while condition.
A common contrived example is continuously asking for valid user input. My condition to check if the input is valid would be within the while, however I need the request for input to execute at least once before checking the condition, so I use a do...while.
Thank you! makes sense. :)