Oops, the outer block is an if block. I meant that you can change the if block to while and drop the inner loop.