Quote Originally Posted by CarlMartin10 View Post
The book wants me to add to the code what is needed. I could easily write it all differently, but that defeats the purpose of doing what they ask me to do, and the lesson it is supposed to reinforce.
A loop that is hard-coded to only execute once is either a typo (and if this is from a book, it's fairly common to find code bloopers in books) or a deliberate error that you're expected to correct. I don't know which, but either way, you should fix it. As it is, it doesn't loop - it's clearly wrong. Having said that, the loop statement should be removed entirely - given the context, it's clearly unnecessary and potentially confusing.

YMMV.

Question authority; but, raise your hand first...
A. Dershowitz