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 RealBasic

Date:04/20/05
Author:Anonymous
URL:n/a
Comments:2
Info:http://www.realsoftware.com/
Score: (2.54 in 26 votes)
// "99 Bottles of Beer on the Wall" for RealBasic (http://www.realsoftware.com/)
// Written by Uriah Carpenter
// To run add the below code to the "Open" event of a listbox
  
dim bottles as integer
dim plural as string
bottles = 99
plural = "s"
  
do
  me.addRow(str(bottles) + " bottle" + plural + " of beer on the wall, " +
str(bottles) + " bottle" + plural + " of beer.")
  bottles = bottles - 1
  if bottles = 1 then
    plural  = ""
  else
    plural = "s"
  end if
  me.addRow("Take one down, pass it around, " + str(bottles) + " bottle" +
plural + " of beer on the wall.")
loop until bottles = 0

Download Source | Write Comment

Alternative Versions

Comments

>>  Ken Ray said on 07/26/06 05:49:02

Ken Ray This is not exactly a correct submission; it doesn't handle the two last stanzas, where you shift from 1 bottle to "no more bottles", and where you "go to the store and buy some more". Perhaps someone should amend this and repost?

>>  Tom Benson said on 01/17/07 04:21:03

Tom Benson dim bottles as integer = 99
dim plural as string = "s"

do until bottles = 0
me.addRow(str(bottles) + " bottle" + plural + " of beer on the wall, " +
str(bottles) + " bottle" + plural + " of beer.";)
if bottles > 1 then
me.addRow("Take one down, pass it around, " + str(bottles) + " bottle" + plural + " of beer on the wall.";)
else
plural = ""
me.addRow("There's no more bottles of beer on the wall, No more bottles of beer.";)
me.addRow("Go to the store and get some more, there's 99 bottles of beer on the wall.";)
end
bottles = bottles - 1
loop

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: