Friday, April 25, 2008

We will never agree

From another post :


In Ruby I can write this:

10.times { i puts i }

But in C# I have to write this:

for (int i = 0; i < 10; i++)
{
Console.Write (i);
}

Which do you find more beautiful? :-)



Actually, I strongly prefer the C# version. Not because it is more beautiful, but because it is more descriptive. How do I know whether "10.times" will count from 0 to 9 or from 1 to 10? Or from 412 to 421? How do I know that it will count upwards ? Or backwards? Or randomly?

And anyway...

10.Times (i => Console.Write(i) )


:-)))

No comments: