when would you use a do while loop

I understand that a do while loop always runs the block of code at least once, but can anyone give me some examples when this would be required instead of just using a normal while loop thanks

//it is impossible to determine if the loop needs more than one loop
do {
  //do something that determines if we need more loops
} while (condition);

Examples might be if you need a certain algorithm applied to a dataset, but you do not know the result of the algorithm before it's applied, AND the result of the algorithm determines if it needs to run again.

Are there any real world examples. I've looked but have been unable to find anything definitive

int uniqueRandom = 0;
int prevRandom = 0;

//further down the code:

do { 
  uniqueRandom = rand() % 10;
} while (uniqueRandom==prevRandom);
prevRandom = uniqueRandom;

That code snippet will always make uniqueRandom a random number between [0,10) but it will never return the same number sequentially.

Best I could think of right now.

Token parsing is an example where the do while loop might be useful.

char *mess = "Hey I am a multi token string";
char *token = strtok(mess, " ");
      Serial.print("Token: ");
   } while(token = strtok(NULL, " "));

This will get the first token. If it got one, it uses a do/while loop to print it, and get the next token. The while loop ends when there are no more tokens, which only happens when attempting to extract a token beyond the last one.

Reading from a file is another typical task done in a do/while loop.

thanks for the examples