Doing the check in the if statement is the same as doing it in the actual while segment. You don't actually gain anything there, unless you just happen be checking to do something for a special case...