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 PL/B

(ANSI Standard PL/B)

Date:11/18/05
Author:Brian J. Jackson
URL:http://www.adjacency.net
Comments:1
Info:http://www.sunbelt-plb.com
Score: (1.67 in 3 votes)
./////////////////////////////////////////////////////////////////////////////.
.// ANSI Standard PL/B version of 99 bottles of beer                        //.
.//   Brian J. Jackson, Adjacency Consulting Group, Inc. (www.adjacency.net)//.
.//   17 NOV 2005                                                           //.
./////////////////////////////////////////////////////////////////////////////.
bottleCount     form    2
bottleString    dim     8
bottleString2   dim     8
./////////////////////////////////////////////////////////////////////////////.
start

.   // set our bottle counter to 99, then begin our descent
    move "99" to bottleCount
    loop
.       // logic to ensure our display is grammatically correct (although
.       //  I don't know why that would matter after drinking 98 bottles of
.       //  beer!)
        if (bottleCount = 1)
.           // 1 bottle of beer left
            move " bottle" to bottleString
            move " bottles" to bottleString2
        elseif (bottleCount = 2)
.           // 2 bottles left, then one bottle in the last stanza
            move " bottles" to bottleString
            move " bottle" to bottleString2
        else
.           // 3 or more bottles left
            move " bottles" to bottleString
            move " bottles" to bottleString2
        endif

.       // display the first three lines of the song
        display *ll,bottleCount,bottleString," of beer on the wall...":
                *n,bottleCount,bottleString," of beer...":
                *n,"take one down, pass it around...";

.       // now drink a bottle
        subtract "1" from bottleCount

.       // and finish the verse
        display *n,bottleCount,bottleString2," of beer on the wall.":
                *n,*n;
    repeat until (bottleCount = 0)

    stop
///////////////////////////////////////////////////////////////////////////////

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
1Tony Presnow01/06/090

Comments

>>  Gordon E. Peterson II said on 08/14/07 20:10:54

Gordon E. Peterson II Again, it's a pity that the author didn't go to the trouble to get the output right, so it matches exactly the "official lyrics" as shown on the site... this is an exercise where the devil is in the details.

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: