99 bottles of beer

AUTHOR

Gerhard R

Print the lyrics to the 99 bottles of beer song.

use v6;



my @bottles = (flat ((99...2) X~ ' bottles'),
              '1 bottle',
              'no more bottles',
              '99 bottles');

my @actions = (flat 'Take one down and pass it around' xx 99,
              'Go to the store and buy some more');

for flat @bottles Z @actions Z @bottles[1..*] {
    say "$^a of beer on the wall, $^a of beer.
$^b, $^c of beer on the wall.\n".tc;
}

# vim: expandtab shiftwidth=4 ft=perl6

See Also

array-contains-a-value.pl

Determine whether an array contains a value

combinations.pl

Combinations

malware_analysis.raku

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.