I'd actually structure the loop as a do/while, since the loop body needs to be executed at least once.

The points mentioned by Salem are also critical to getting the code working as (presumably)...