Moving in and out of a do while loop?