Iterating lists
Use for to iterate over things that provide iterators
Each item is passed to the block
my @suits = <Clubs Diamonds Hearts Spades>;
for @suits {
say $_;
}
Or as a statement modifier
say $_ for @suits;continued...
| Perl 6 | Cool Perl 6 | #13 |
Use for to iterate over things that provide iterators
Each item is passed to the block
my @suits = <Clubs Diamonds Hearts Spades>;
for @suits {
say $_;
}
Or as a statement modifier
say $_ for @suits;continued...
|
Copyright © 2010 http://www.pmichaud.com/2010/pres/ |