Loops/Foreach: Difference between revisions

Content added Content deleted
Line 2,275: Line 2,275:
for @collection { .say };</lang>
for @collection { .say };</lang>
Iteration can also be done with hyperoperators. In this case it's a candidate for autothreading and as such, execution order may vary. The resulting list will be in order.
Iteration can also be done with hyperoperators. In this case it's a candidate for autothreading and as such, execution order may vary. The resulting list will be in order.
<lang per6>@collection>>.say;
<lang perl6>@collection>>.say;
@collection>>.=&infix:<+>(2); # increment each element by 2</lang>
@collection>>.=&infix:<+>(2); # increment each element by 2</lang>