Joe Gottman skribis 2005-01-13 19:35 (-0500):
> In Perl5, given code like
> for (my $n = 0; $n < 10; ++$n) {.}
> the control variable $n will be local to the for loop. In the equivalent
> Perl6 code
> loop my $n = 0; $n < 10; ++$n {.}
> $n will not be local to the loop but will instead persist until the end of
> enclosing block.
What is wrong with { loop my $n = 0; $n < 10; ++$n { ... } }? I find
that syntax much easier to read and certainly more clearly indicating
scope.
With loop 0 -> $n; ...; ... { ... }, the -> is too far away from the
block, imho.
Juerd