real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language PowerBatch

(I must have been bored.)

Author:Christopher Mathews
Score: (2.94 in 17 votes)
Variable  lvBeers,100                          
Variable  lvBeersOnWall,30
Variable  lvEndBeers,30
Variable  lvCount,3
Variable  lvTakeOne,100
Variable  lvTake,100
Variable  lvLength,3
Variable  lvFinalTake,100
Variable  lvOneBottle,100
SetVar    lvBeers,99
SetVar    lvTake,99
SetVar    lvCount,99
SetVar    lvBeersOnWall," bottles of beer on the wall, "
SetVar    lvOneBottle," bottle of beer on the wall, "
SetVar    lvTakeOne, "Take one down and pass it around, "
Label     MainLoop 
Concat    lvBeers,lvBeersOnWall                             
Subtract  lvTake,1
Concat    lvTake,lvBeersOnWall
Concat    lvTakeOne,lvTake
MidString lvEndBeers,lvBeers,1,18
Concat    lvBeers,lvEndBeers
WriteLine lvBeers
Length    lvLength,lvTakeOne
Subtract  lvLength,2
MidString lvFinalTake,lvTakeOne,1,lvLength
WriteLine lvFinalTake
Subtract  lvCount,1
SetVar    lvTake,lvCount
SetVar    lvBeers,lvCount
SetVar    lvTakeOne,"Take one down and pass it around, "
Compare   lvCount,1,MainLoop,OneBeer
Label     OneBeer
Concat    lvBeers,lvOneBottle
MidString lvEndBeers,lvBeers,1,17
Concat    lvBeers,lvEndBeers
WriteLine lvBeers
Concat    lvTakeOne,"No more bottle of beer on the wall"
WriteLine lvTakeOne
WriteLine "No more bottle of beer on the wall, no more bottles of beer."
WriteLine "Go to the store and buy some more, 99 bottles of beer on the wall."

Download Source | Write Comment

Alternative Versions


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!




Security Code: