[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Oct 29 14:22:17 1995 
Subject:Re: Pop Beer Needed 
From:Adrian Howard 
Volume-ID:951030.01 

In article <46p9dm$bg4@ionews.ionet.net>,
Tim Robinson <timtroyr@ionet.net> wrote:
>I have a web page that shows how to display the lyrics to 99 Bottles of Beer
>in different programming languages (full explanation of this silly thing found
>on the web page).  However, I lack a version in Pop.  (In fact, I couldn't
>even tell you what it is... sorry.)

Well, here's one way of doing it.... I'm sure others will follow:

/*----------------------------------------------------------------*/

define beer(n);

    define :inline PLURAL(N);
        (N==1 and nullstring or "s")
    enddefine;

    lvars i;
    for i from n by -1 to 1 do;
        nl(1);
        printf(PLURAL(i), i, '%P bottle%P of beer on the wall.\n');
        printf(PLURAL(i) ,i, '%P bottle%P of beer!\n');
        printf(i==1 and "it" or "one", 'Take %P down, pass it around.\n');
        if i>1 then
            printf(PLURAL(i-1) ,i-1, '%P more bottle%S of beer on the wall.\n');
        else
            npr('No more bottles of beer on the wall.');
        endif;
    endfor;

enddefine;

beer(100);

/*----------------------------------------------------------------*/

Adrian

aids (adrianh@cogs.susx.ac.uk)  ObDisclamer: Poplog used to pay my wages
Phone: +44 (0)1273 678367 URL: http://www.cogs.susx.ac.uk/users/adrianh/