Quote:
Originally posted by Python523
the php name for it makes more sense I think, too bad graal doesn't use it
foreach(array as var)
for each element in array, it will set the single element as var, and continue on in the loop until there are no more elements to declare 'var' as
|
I like the Perl way better, it makes more sense, I think.
foreach $var (@somearray) {
Or, if you use strict (which is far superior to normal perl in terms of coding, because it forces you to code more efficiently, and even helps you locate bugs more quickly) and have not declared the variable yet:
foreach my $var (@somearray) {