My rule of thumb is to use for loops if I have control over when the loop will stop---for example if I want it to work X times or if I want it loop while X < Y, etc, AND if the increment I want to make is the same each time through the loop. If those criteria can't be met then I use a while or do/while loop. I usually use a while loop unless I want the while loop to run at least once, no matter what, in which case I use a do/while loop.
Reputation Points: 718
Solved Threads: 373
Nearly a Posting Maven
Offline 2,253 posts
since Jul 2005