switch to while-do