‘do…while’ vs. ‘while’

If you always want the loop to execute at least once. It’s not common, but I do use it from time to time. One case where you might want to use it is trying to access a resource that could require a retry, e.g.

do
{
   try to access resource...
   put up message box with retry option

} while (user says retry);

Leave a Comment