in reply to Re: On Foreach Loops and Maintainability
in thread On Foreach Loops and Maintainability

But it's only in 1 place that you have to look to change the code. What if you use the construct "arg$_" multiple times in the body of the loop? It will be slightly harder to change that, and make sure you have gotten them all.

Counting the keystrokes in my favorite editor to change arg to param in any of the above examples: ctrl-shift-5 a r g \n p a r a m \n !

12 keystrokes, easy enough. If you are worried about replacing other things, then it's +1 stroke per interactive search/replace....

Like FoxCub said, I think if you have both methods in your toolbox, and can use them when appropriate, then you are a better programmer for it.

  • Comment on Re: Re: On Foreach Loops and Maintainability

Replies are listed 'Best First'.
Re: Re: Re: On Foreach Loops and Maintainability
by perrin (Chancellor) on Oct 11, 2002 at 17:53 UTC
    That's true, but it sets off my "once and only once" radar. I don't like repeating things.