Erik de Castro Lopo wrote:

All you've done is replace the for loop with a while loop. You are
still setting the start condition and the end condition for the looping operation. These are things the compiler (or rather the
language) expect you to do.

In Io (a dynamically typed language) you'd do:

   array := List clone append(3, 2, -1, 4, 11, 1231232)
   array foreach(i, v, writeln("array[", i, "] = ", v))

and foreach tends to be defined for just about every data type so you get a lot of consistency.

But yes, you're right, the C language should have a foreach keyword.

Trent
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to