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 DarkBasic Professional

(The Darkbasic Professional version)

Date:09/20/05
Author:Nicholas Kingsley
URL:http://www.nicholaskingsley.co.uk
Comments:3
Info:http://www.darkbasicpro.com
Score: (2.90 in 30 votes)
global t$ as string

for bottles=99 to 1 step -1
   t$=isPlural(bottles)

   t$=t$+" of beer on the wall"

   print t$;", ";t$
   print "Take one down and pass it around, ";

   if bottles-1>0
      print isPlural(bottles-1);
      print " of beer on the wall"
   else
      print "No more bottles of beer on the wall"
   endif
   sync
next bottles

print "No more bottles of beer on the wall, no more bottles of beer."
print "Go to the store and buy some more, 99 bottles of beer on the wall..."
wait key

function isPlural(bottles as integer)
local temp$ as string

   temp$=str$(bottles)+" bottle"
   if bottles>1
      temp$=temp$+"s"
   endif
endfunction temp$

Download Source | Write Comment

Alternative Versions

Comments

>>  Albert said on 11/23/05 15:22:44

Albert Great bit of code there, although you did forget the END function after WAIT KEY...

>>  El Go0rf said on 01/15/06 15:50:09

El Go0rf don't need END, since after wait key the program has nothing to do so it terminates anyway.

>>  Nicholas Kingsley said on 05/25/07 11:06:20

Nicholas Kingsley Technically, with the latest updates to DBPro, an END statement would be needed, otherwise a messagebox pops up, saying something along the lines of 'You cant run into a function'...

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: