rosetta code

Monkey Archive Forums/Monkey Discussion/rosetta code

AdamRedwoods(Posted 2012) [#1]
99 bottles of beer, and no monkey.
http://rosettacode.org/wiki/99_Bottles_of_Beer

i suppose one is in order? i guess one that shows off some features like generic types or interfaces?


Paul - Taiphoz(Posted 2012) [#2]
I shoved a quick version up, feel free to do a better one tho if you want ..


NoOdle(Posted 2012) [#3]
I wrote a quick version... doesn't show off any features, just uses a simple recursive function.

Function Main()
	BeerWall( 99 )
End Function

Function BeerWall( amount : Int )
	If amount = 0 Then Return
	Print amount + " bottles of beer on the wall"
	Print amount + " bottles of beer"
	Print "Take one down, pass it around"
	Print ( amount - 1 ) + " bottles of beer on the wall"	
	BeerWall( amount - 1 )
End Function



Paul - Taiphoz(Posted 2012) [#4]
your missing part of the song at the end. but yeah thats a lot slicker than what I added.


NoOdle(Posted 2012) [#5]
are you sure? looks fine to me. (you might have to scroll down a bit to see the last few lines)


Paul - Taiphoz(Posted 2012) [#6]
it's the little goto the store and buy some more bit at the end your missing, at least I cant see it.


NoOdle(Posted 2012) [#7]
ah ok I didn't add those lines, I copied the structure from the link:

X bottles of beer on the wall
X bottles of beer
Take one down, pass it around
X-1 bottles of beer on the wall

X-1 bottles of beer on the wall
...
Take one down, pass it around
0 bottles of beer on the wall