How to use Timer to exit LoopA,then run LoopB?

PaulS:

    quitTime = millis () + 10000;

Adding unsigned longs is not a good idea in robust code.

    do {

// Do stuff
    } while (millis () - startTime < diddleTime);



is guaranteed to work. Though I suspect that a do/while is NOT the construct you want to use. While probably is. Look up the differences.

I had to think about it but I understand the part about adding unsigned longs. In the corrected version millis() - startTime will never result in a wrap around because startTime can not be larger than millis() result. Except after those 50 days when result of millis() wraps around. But that is more esoteric, if the machine isn't expected to stay on for such long time.

But the part about while instead of do/while?
The difference I know is that do/while will execute at least once. My thinking was that it will save one loop condition check in this particular application, if setting the startTime (or as I had written, the quitTime) just before the loop and we want to interrupt after several seconds it till definitely don't have time to become false for that first iteration (using interrupts and having a lot of heavy code in the interrupt could cause this if the interrupts occurs exactly after the variable assignment). Also the code could be / probably would be written that the second loop expects to run after the first one, not that one time the first loop will be skipped.
Because of this reasons I thought that having the loop condition check after the first run was the most economical and effective one.
Am I wrong in my intention why to use do/while or is it some other side effect that I'm unaware of?