Guy (), Carl (), Moritz ():
for @($ar) { ... }
This would arguably be the nicest variant.
Well, actually, by this I meant all three variants that Moritz suggested. :)
for @$ar { ... }
or even
for @ $ar { ... }
or
for @($ar) { ... }
Guy ():
for ( @$ar ) { ... }
?
That's Moritz'
So, I have found workaround for now:
my $ar = [1,2,3]; loop ( my $i = 0; $i $ar.elems; $i++ ) { $ar[$i].say }
1
2
3
2008/10/30 Илья [EMAIL PROTECTED]:
I have found one:
my $ar = [1,2,3]; my $i = 0; while $i $ar.elems {say $ar[$i]; $i++ };
1
2
3
2008/10/30 Carl Mäsak [EMAIL PROTECTED]:
On Thu, 30 Oct 2008, wrote:
Hi there,
question about arrays and array refs in Rakudo today.
I have array ref
my $ar = [1,2,3];
how can I go over it?
I try:
my $r = [1,2,3]; say $r.elems;
3
my $r = [1,2,3]; say $r.WHAT;
Array
my $r = [1,2,3]; Y.say for $r;
Y
my $r = [1,2,3]; .say
On Thu, 30 Oct 2008, Carl Mäsak wrote:
Timothy ():
my $r = 1 2 3; for $r - $t { say $t };
Which revision of Rakudo are you running? In my r32239, it outputs 1
2 3 on the same line (i.e. it doesn't iterate over each element).
Oops. My bad. Try either of the following with parrot