Like in which situation would it be better than just using a while loop.
The example that is often used is a menu that you want to be run atleast once.
Would it not be better in this case to declare a variable, set it to true or whatever, and then inside the loop have a condition that sets it to false to exit ?
Would it not be better in this case to declare a variable, set it to true or whatever, and then inside the loop have a condition that sets it to false to exit ?
To me, that's more lines of code, and more variables to write.
If i was reading someone's code and trying to understand it I think seeing:
i dont use them. I use method the OP stated. That could just be because i jump back and forth between languages that do not have a do-while loop, and i find it a lot easier to use one method through all the languages.