Thursday, January 11, 2007

The new iterator...

I was exposed to C# nearly seven months ago. Then only I got to know about this amazing cool loop in C#.., the foreach loop. Then later at a course in my undergraduate program, i saw it appear in Perl scripting. It was cool. During my second year projects at my campus I used it extensively, mostly for database programming.
But later i began to worry...Can't we survive without it? Because programming languages like C & C++ have survived for some years without that loop i guess. But my guess was wrong, because C++ did have a for_each function as in this link:-

http://en.wikipedia.org/wiki/Foreach

But is it just because only this mistake we have to shift to the foreach loop..
However i believe it depends on the preference of the programmer...

No comments: