[Solved] for(;;) vs do..while() for main program loop [closed]


do...while is completely equivalent to a for loop except the test is done at the end of the loop instead of at the beginning, so a do...while always runs at least once. In both cases you can exit the loop with break. You don’t need to throw an exception, but of course you can. If you’re multiple levels deep, it’s often easier to throw an exception and either catch it in the loop and break, or set the termination condition, or else catch the exception outside the loop which will also terminate it.

1

solved for(;;) vs do..while() for main program loop [closed]