Update: it looks like Jeff fixed my comment (and removed the comment I left afterward that basically said, gee my comment got messed up) rendering this post pretty much pointless.... Oh well.... Thanks for fixing my original comment Jeff!
So I wrote what was suppose to be a funny bit of ridiculous code as a comment to a comment on Jeff Atwood's blog about Curly's Law: Do One Thing.
His comment software ate the bulk of the code rendering the joke, well, on me... so if you're getting here because you clicked on my link on the comment, here's the original comment:
"Does that mean you have to not re-use i for loops? :)"
Clearly it means you should only code a for-loop once. I can only assume the prescribed code would look something like this:
public delegate void LoopProcessDelegate(int ndx);
public void Loop(int startNdx,
int endNdx,
LoopProcessDelegate process)
{
for (int i = startNdx; i < endNdx; i++)
{
process(i);
}
}
public void TestLoop()
{
Loop(0, 9, new LoopProcessDelegate(
delegate(int ndx)
{
Console.WriteLine(
string.Format("{0} : Hello World", ndx));
}));
}
Isn't that much better?
-Andy
<disclaimer>
For the humor-impaired, yes, this is a joke.
Nice article Jeff...
</disclaimer>
Yeah, so it's not that funny. But hey I haven't written an entry in while...
-Andy