Your task if you choice to accept is reproduce the song. Just for <beep> & giggles.
QUOTE(99 Bottles of beer song)
99 bottles of beer on the wall, 99 bottles of beer.
Take one down pass it around, 98 bottle of beer on the wall.
etc.
1 bottles of beer on the wall, 1 bottle of beer.
Take one down 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 buy some more, 99 bottles of beer on the wall.
Constraints: You can't use
bottle(s)I'll start with mine
CODE
Module BottlesOfBeer
Sub Main()
Dim Bottle = Function(b) " bottle" & If(b > 1, "s", "") & " of beer"
Dim GotBeer = Function(b) If(b > 0, b & Bottle(b), "No more bottles of beer")
Dim OnWallLine = Function(b, r) GotBeer(b) & " on the wall" & If(r >= 0, ", " & GotBeer(b), "") & "." & vbNewLine
Dim TakeOneDownLine = Function(b) If(b >= 0, "Take one down and pass it around, " & OnWallLine(b, -1), "Go to the store and buy some more, " & OnWallLine(99, -1))
Dim Verses = (From i In Enumerable.Range(0, 100).Reverse Select CStr(OnWallLine(i, 0) & TakeOneDownLine(i - 1))).ToArray
Array.ForEach(Of String)(Verses, (New Action(Of String)(AddressOf PrintVerse)))
End Sub
Private Sub PrintVerse(ByVal v As String)
Console.WriteLine(v)
Console.ReadLine
End Sub
End Module
Happy Coding
This post has been edited by AdamSpeight2008: 11 Jun, 2009 - 03:57 PM