Guest User

Untitled

a guest
May 25th, 2026
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.58 KB | None | 0 0
  1. for 99...1 -> $counter {
  2.     sing $counter, :wall;
  3.     sing $counter;
  4.     say  "Take one down, pass it around";
  5.     sing $counter - 1, :wall;
  6.     say  "";
  7. }
  8.  
  9. #| Prints a verse about a certain number of beers, possibly on a wall.
  10. sub sing(
  11.     Int $bottles, #= Number of bottles of beer.
  12.     Bool :$wall #= Mention that the beers are on a wall?
  13. ) {
  14.     my $quantity = $bottles == 0 ?? "No more"      !! $bottles;
  15.     my $plural   = $bottles == 1 ?? ""             !! "s";
  16.     my $location = $wall        ?? " on the wall" !! "";
  17.     say "$quantity bottle$plural of beer$location"
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment