Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Hummingbird Basic

Date:04/20/05
Author:Eric Korpela
URL:n/a
Comments:0
Info:n/a
Score: (3.00 in 52 votes)
' Hummingbird Basic version of the Beer Song
' By Eric Korpela (http://setiathome.ssl.berkeley.edu/~korpela)

Function DisplayBox(verse$, i%)
  If (i<>1) Then
    DisplayBox=Msgbox(verse, 4, "Verse")
  Else
    DisplayBox=Msgbox(verse, 0, "Verse")
  End If  
End Function

Function Plural$(i%)
  If (i%=1) Then Plural="" Else Plural="s" 
End Function

Function NewFormat$(i%)
  If (i%=0) Then NewFormat="No" Else NewFormat=Format(i%)
End Function

Sub Main
  Dim verse$, i%
  For i%=99 to 1 step -1
    verse=Format(i%) & " bottle" & Plural(i%) & " of beer on the wall." & chr$(13)
    verse=verse & Format(i%) & " bottle" & Plural(i%) & " of beer."& chr$(13) 
    verse=verse & "You take one down and pass it around" & chr$(13)
    verse=verse & NewFormat(i%-1) & " bottle" & Plural(i%-1) 
    verse=verse & " of beer on the wall." & chr$(13) & chr$(13)
    If (i<>1) Then verse=verse & "Drink more?"
    If (DisplayBox(verse, i)=7) Then 
      Msgbox "What a light weight!",48,"Wimp Out"
      Exit For
    End If 
  Next i%
End Sub

Download Source | Write Comment

Alternative Versions

Comments

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: