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 PowerScript

Date:04/20/05
Author:Nathan Pralle, Ryan Grummer
URL:n/a
Comments:1
Info:n/a
Score: (3.01 in 101 votes)
$PBExportHeader$f_99_bottlesofbeer.srf
global type f_99_bottlesOfBeer from function_object
end type

forward prototypes
global function integer f_99_bottlesofbeer ()
end prototypes

global function integer f_99_bottlesofbeer ();//PowerScript Version
//99 Bottles of Beer on the Wall
//PowerScript 8.x in PowerBuilder 8.x by Sybase
//www.sybase.com
//Written by:
//  Nathan Pralle http://tarsi.binhost.com
//  Ryan Grummer rgrummer@frontiernet.net

long ll_numBottles=99
string ls_message

do while(ll_numBottles>0)
         ls_message=string(ll_numBottles)+" bottle(s) of beer on the wall.~r~n"
         ls_message=ls_message+string(ll_numBottles)+" bottle(s) of beer.~r~n"
         ls_message=ls_message+"Take one down, pass it around.~r~n"
         ls_message=ls_message+string(ll_numBottles - 1)+" bottle(s) of 
beer on the wall."
         MessageBox("99 Bottles of Beer",ls_message)
         ll_numBottles=ll_numBottles - 1
loop
return 1

end function

Download Source | Write Comment

Alternative Versions

Comments

>>  johann said on 01/28/07 17:34:57

johann The 99 Messageboxes don't display the right text. So here is a alternative version with the whole lyrics of the song

long ll_loop
string ls_msg = ""

for ll_loop = 99 to 1 step -1;
if ll_loop > 1 then
ls_msg = ls_msg + string(ll_loop) +" bottles of beer on the wall, " + string(ll_loop) + " bottles of beer.~r~n"
else
ls_msg = ls_msg + "1 bottle of beer on the wall, 1 bottle of beer.~r~n"
ls_msg = ls_msg + "Take one down and pass it around, no more bottles of beer on the wall.~r~n~r~n"
end if
if ll_loop > 2 then
ls_msg = ls_msg + "Take one down and pass it around, "+ string(ll_loop - 1) + " bottles of beer on the wall.~r~n~r~n"
elseif ll_loop = 2 then
ls_msg = ls_msg + "Take one down and pass it around, 1 bottle of beer on the wall.~r~n~r~n"
end if
next
ls_msg = ls_msg + "No more bottles of beer on the wall, no more bottles of beer.~r~n"
ls_msg = ls_msg + "Go to the store and buy some more, 99 bottles of beer on the wall."

MessageBox("99 Bottles of Beer",ls_msg)

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: