> However, I like doing [the check] at the top. I think it is easier to see what it is doing and it has less conditions in the while loop to evaluate when it iterates.

Okay, that sounds reasonable to me. I'll merge the pull request now.