If you don't want any results with less than 3 lines: for lines.rotor(3) -> @a { dd @a; }
If you *do* want results with 3 lines: for lines.rotor(3, :partial) -> @a { dd @a; } Alternately as shown below: for lines -> $x, $y?, $z? { dd $x, $y, $z } Note the question marks to make $y and $z optional: otherwise the last iteration will throw an exception if there were less than 3 lines left. > On 23 Nov 2019, at 12:30, Raymond Dresens <raymond.dres...@gmail.com> wrote: > > Hello, > > This seems possible: > > > my @x = (1, 2, 3, 4, 8, 16, 32, 64, 128); > [1 2 3 4 8 16 32 64 128] > > Then: > > > for @x -> $x, $y, $z { $x.say } > 1 > 4 > 32 > > And: > > > for @x -> $x, Any, Any { $x.say } > 1 > 4 > 32 > > ...assigning to 'Any' seems to 'just work'. Assigning to 'Nil' didn't work, > however. > > Is this what you are looking for? > > Perhaps there's a better way for doing this? If so, I'd like to know too :) > > Regards, > > Raymond. > > On Sat, 23 Nov 2019 at 07:00, ToddAndMargo via perl6-users > <perl6-us...@perl.org> wrote: > Hi All, > > In a "for" loop, what is the syntax for "by 3"? > > for @x.lines by 3 > > In other words, every third line. > > Many thanks, > -T