in reply to at continue, last
Agree ... this is the sort of code that I shudder to see, and see a lot. Because of the way such code is constructed, it is difficult to “see” the conditions under which a particular bit of code might be executed. Therefore, it is difficult to predict what conditions might actually prevail when a particular bit of (buggy) code is actually executing. It is also difficult to locate all of the places where the value of a particular variable, such as $loop, is being manipulated, and to be certain that every single one of them is correct and that the entire set is complete. When we harped at an entire generation of coders-to-be, “don’t use goto,” what I really think that we were trying to say is, “don’t be hard-to-follow or hard-to-predict.”
Your comments are interesting, valid, and therefore, appreciated. But when I encounter code like this, I usually have someone rewrite (“refactor” is the buzzword these days) the code and to write a bunch of tests to prove what it does, before and after. And, if you look at such “monstrosities” long enough, you almost-inevitably find One More Bug™, or even, This Bug Is The Business Truth.™