Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for 99...1 -> $counter {
- sing $counter, :wall;
- sing $counter;
- say "Take one down, pass it around";
- sing $counter - 1, :wall;
- say "";
- }
- #| Prints a verse about a certain number of beers, possibly on a wall.
- sub sing(
- Int $bottles, #= Number of bottles of beer.
- Bool :$wall #= Mention that the beers are on a wall?
- ) {
- my $quantity = $bottles == 0 ?? "No more" !! $bottles;
- my $plural = $bottles == 1 ?? "" !! "s";
- my $location = $wall ?? " on the wall" !! "";
- say "$quantity bottle$plural of beer$location"
- }
Advertisement
Add Comment
Please, Sign In to add comment