💾 Archived View for blitter.com › apl-examples › beer-song › instructions.md.txt captured on 2024-05-26 at 14:43:12.

View Raw

More Information

⬅️ Previous capture (2023-05-24)

-=-=-=-=-=-=-

# Instructions

Your task is write a program that outputs the old road-trip standby,
 "99 Bottles of Beer on the Wall".

Note that not all verses are identical.

## Lyrics

99 bottles of beer on the wall, 99 bottles of beer.

Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.

Take one down and pass it around, 97 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.

Take one down and pass it around, 96 bottles of beer on the wall.

96 bottles of beer on the wall, 96 bottles of beer.

Take one down and pass it around, 95 bottles of beer on the wall.

...

...

2 bottles of beer on the wall, 2 bottles of beer.

Take one down and pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.

Take it down and pass it around, no more bottles of beer on the wall.

No more bottles of beer on the wall, no more bottles of beer.

Go to the store and buy some more, 99 bottles of beer on the wall.


How will you print out the original number of bottles at the end
of the song?

Watch out for 0 bottles or negative amounts of bottles!

## For bonus points

The 'simplest' solution may be recursive. Can you come up with
another solution that uses tail recursion, or is iterative?