What is the method by which a programmer selects the style of loop to use? I have been looking around but I can't seem to get a straight answer. I understand that you can wrangle most looping styles into working for any particular problem, but when I "guess" a good loop, everything just goes well.
My question is...Is there a formal methodology to determine the best type of loop to at least start with?
I'm currently studying Ruby and sometimes not knowing when to enumerate and when to use a more manual loop i.e. a while loop.
Articles, old posts or good books would all be valid answers.
Thanks!