Created
April 24, 2017 19:33
-
-
Save greggirwin/77b94dba0b4191c86c03426c71a4dee5 to your computer and use it in GitHub Desktop.
99 Bottles of Beer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bottles: func [n][ | |
switch/default n [ | |
0 ["no more bottles"] | |
1 ["1 bottle"] | |
][form reduce [n "bottles"]] | |
] | |
verse: func [n][ | |
either n = 0 [ | |
{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.} | |
][ | |
form reduce [ | |
bottles n "of beer on the wall," bottles n "of beer.^/" | |
"Take one down and pass it around," bottles (n - 1) "of beer on the wall.^/" | |
] | |
] | |
] | |
repeat i 100 [print verse 100 - i] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment