Perl 6 Cool Perl 6 #19

Iterating n values at a time

Placeholders parameters also work:

# as pointy block
for 1..12 -> $a, $b, $c, $d { say "$a, $b, $c, $d"; }

1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12

# using placeholders
for 1..12 { say "$^a, $^b, $^c, $^d"; }

1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12
Copyright © 2010
http://www.pmichaud.com/2010/pres/