Use do/while instead of while with break control

Small cosmetic change.
Feel free to discard if you don't like