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 VDF

Date:07/01/05
Author:A Paul Anthony
URL:n/a
Comments:2
Info:http://www.dataaccess.com
Score: (3.00 in 25 votes)
Procedure mPrintBeer
    Integer iMax iCount iBottles
    String sCRLF sVerse

    Move 100 to iMax
    Move (character(13) + character(10)) to sCRLF

    For iCount from 0 to iMax
        Move (iMax - iCount) to iBottles

        Move (String(iBottles) * "Bottles of beer on the wall,";
            * String(iBottles) * "bottles of beer." + sCRLF ;
            + "Take one down and pass it around,";
            * if((iBottles = 1), "no", String(iBottles - 1));
            * "bottle of beer on the wall." + sCRLF ) to sVerse

        ShowLn sVerse
    Loop

    Move ("No more bottle of beer on the wall.";
       * "No more bottles of beer..." + sCRLF;
       + "Go to the store and buy some more...";
       * "99 bottles of beer.") to sVerse

    ShowLn sVerse
End_Procedure

Download Source | Write Comment

Alternative Versions

Comments

>>  A Paul Anthony said on 07/01/05 15:53:45

A Paul Anthony This was written far too late last night and without the aid of eny environent to check syntax etc.

I'm now kicking myself with regards to starting the count at 100, not 99. The last verse should probably also use iMax as the suggested beer to buy quantity.

Oh, and the "1 bottles of beers" classic...

>>  Gwen20Montgomery said on 07/08/10 14:12:39

Gwen20Montgomery That's well known that money can make people disembarrass. But what to do when somebody has no money? The one way only is to get the <a href="http://bestfinance-blog.com/topics/business-loans">business loans</a> and student loan.

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: