Macintosh WordPerfect

    
    ; Here is the Macintosh WordPerfect macro language version.
    
    Assign (Var01;99)
    Repeat
      Type Var (Var01)
      Type ( bottles of beer on the wall.  )
      Type Var (Var01)
      Type ( bottles of beer.  )
      Type (Take one down, pass it around.  )
      Assign (Var01;Var01-1)
      Type Var (Var01)
      Type ( bottles of beer on the wall.)
      Hard Return
    Until (Var01=0)
    
    

    Modula 2

    (* Modula-2 version of 99 Bottles of Beer            *)
    (* Tested on a VAX 7700 running OpenVMS              *)
    (* Programmer: Jeremy Rule  rulej@tempest.adsnet.net *)
    MODULE BottlesOfBeer;
    
    FROM InOut IMPORT WriteCard, WriteString, WriteLn;
    
    CONST
            BOTTLES = 99;
    VAR
            counter : CARDINAL;
    BEGIN
            counter := BOTTLES;
            REPEAT
                    WriteCard( counter,2 );
                    WriteString(" bottles of beer on the wall, ");
                    WriteCard( counter,2 );
                    WriteString(" bottles of beer."); WriteLn;
                    WriteString(" Take one down, and pass it around, ");
                    DEC( counter );
                    WriteCard( counter,2 );
                    WriteString(" bottles of beer on the wall."); WriteLn;
            UNTIL ( counter = 1 );
            WriteString("1 bottle of beer on the wall, 1 bottle of beer"); WriteLn;
            WriteString("Take it down and pass it around, ");
            WriteString("No more bottles of beer on the wall."); WriteLn;
    
    END BottlesOfBeer.
    
    

    Modula 3

    MODULE BottlesOfBeer EXPORTS Main;
     
    FROM IO  IMPORT Put ;
    FROM Fmt IMPORT Int ;
     
    VAR bottles := 99 ;
     
    BEGIN
      WHILE (bottles > 0) DO
        Put(Int(bottles) & " bottle(s) of beer on the wall,\n") ;
        Put(Int(bottles) & " bottle(s) of beer. \n") ;
        Put("Take one down, and pass it around,\n");
        DEC(bottles);
        Put(Int(bottles) & " bottle(s) of beer on the wall.\n");
      END ;
     
    END BottlesOfBeer.
    

    LPC

    LPC was originally conceived as a object oriented C-like language for writing MUDs and being able to modify them on the fly.
    // beersong.c
    // an implementation in the LPC language
    // Tim Hollebeek, 6/6/95 - tim@debusy.Princeton.EDU
    
    private string bottles(int n) {
        switch (n) {
        case 0: return "no more bottles of beer";
        case 1: return "1 bottle of beer";
        default: return n + " bottles of beer";
        }
    }
    
    void beersong() {
        for (int i = 99; i; i--) {
            write(bottles(i) + " on the wall, " + bottles(i)
    	      + ", take one down, pass it around, "
    	      + bottles(i - 1) + " on the wall.\n");
        }
    }
    
    

    Mumps

    ; The following is a single line of code
    beer    ; Randy M. Hayman (haymanr@icefog.alaska.edu)
            for i=99:-1:1 w !,i," bottle",$S(i=1:"",1:"s")," of beer on the wa
    ll, ",i," bottle",$S(i=1:"",1:"s")," of beer.",!,"Take one down, pass it a
    round, ",i-1," bottle",$S(i=2:"",1:"s")," of beer on the wall.",!
    

    ITCL

    #!/usr/local/bin/itcl_sh
    # [incr Tcl] version of "99 bottles of beer"
    # Author: Steven Grady
    # grady@xcf.berkeley.edu
    
    itcl_class bottle {
    	constructor {config} {
    		incr numBottles
    	}
    
    	destructor {
    		incr numBottles -1
    	}
    
    	method drink {} {
    		puts "Take one down, pass it around,"
    		$this delete
    	}
    
    	proc numBottleStr {} {
    		switch $numBottles {
    		  0 {
    			return "No more bottles of beer"
    		  }
    		  1 {
    			return "1 bottle of beer"
    		  }
    		  default {
    			return "$numBottles bottles of beer"
    		  }
    		}
    	}
    
    	proc numBottles {} {
    		return $numBottles
    	}
    
    	common numBottles 0
    }
    
    proc createBottles {numBottles} {
    	for {set i 0} {$i < $numBottles} {incr i} {
    		bottle #auto
    	}
    }
    
    createBottles 99
    foreach b [itcl_info objects -class bottle] {
    	set str [bottle :: numBottleStr]
    	puts "$str on the wall, $str"
    	$b drink
    	puts "[bottle :: numBottleStr] on the wall."
    }
    
    

    M4

    A Unix macro language.
    # by Ozan S. Yigit" (oz@sni.ca)
    #
    define(BOTTLES,`ifelse($1, 0, no more bottles,
    			$1, 1, one bottle, $1 bottles) of beer') dnl
    define(BEER,`ifelse(eval($1 > 0), 1,
    `BOTTLES($1) on the wall, BOTTLES($1)
    take one down, pass it around
    BOTTLES(eval($1 - 1)) on the wall.
    
    BEER(eval($1 - 1))')') dnl
    
    BEER(10)
    
    

    Java

    Java is a machine independent compiler based on C++ which targets to pseudo-code.
    // java version of 99 bottles of beer on the wall
    // 1995 Sean Russell (ser@cs.uoregon.edu)
    
    class bottles
    {
      public static void main(String args[])
        {
        String s = "s";
        for (int beers=99; beers>-1;)
          {
          System.out.print(beers + " bottle" + s + " of beer on the wall, ");
          System.out.println(beers + " bottle" + s + " of beer, ");
          if (beers==0)
            {
            System.out.print("Go to the store, buy some more, ");
            System.out.println("99 bottles of beer on the wall.\n");
            System.exit(0);
            }
          else
            System.out.print("Take one down, pass it around, ");
          s = (--beers == 1)?"":"s";
          System.out.println(beers + " bottle" + s + " of beer on the wall.\n");
          }
        }
    }
    

    Java Script

    Interpretive Java.
    /**
     * 99 Bottles of Beer on the Wall in JavaScript
     * This program prints out the lyrics of an old pub song.
     * Copyright (C) 1996, Brian Patrick Lee (blee@media-lab.mit.edu)
     */
    if (confirm("Are you old enough to read about beer\n" +
    	    "according to your local community standards?")) {
      for (i = 99 ; i > 0 ; i--) {
        j = i - 1;
        if (i != 1) { 
          icase = "bottles"; 
        } else { 
          icase = "bottle";
        }
        if (j != 1) {
          jcase = "bottles";
        } else {
          jcase = "bottle";
        }
        document.writeln(i + " " + icase + " of beer on the wall,");
        document.writeln(i + " " + icase + " of beer,");
        document.writeln("Take 1 down, pass it around,");
        if (j != 0) {
          document.writeln(j + " " + jcase + " of beer on the wall.");
        } else {
          document.writeln("No more bottles of beer on the wall!");
        }
        document.writeln()
      }
    } else {
      document.write("You might want think about moving to another community.")
    }
    

    INTERCAL

    INTERCAL is a real language, apparently created with the notion that programming ought to be hard. Program courtesy Matt Dimeo.
    PLEASE DO ,10 <- #1
    PLEASE DO ,10SUB#1 <- #176
    PLEASE DO ,11 <- #30
    PLEASE DO ,11SUB#1 <- #76
           DO ,11SUB#2 <- #190
           DO ,11SUB#3 <- #80
           DO ,11SUB#4 <- #200
    PLEASE DO ,11SUB#5 <- #256
           DO ,11SUB#6 <- #248
           DO ,11SUB#7 <- #144
           DO ,11SUB#8 <- #216
    PLEASE DO ,11SUB#9 <- #202
           DO ,11SUB#10 <- #14
           DO ,11SUB#11 <- #144
           DO ,11SUB#12 <- #98
    PLEASE DO ,11SUB#13 <- #190
           DO ,11SUB#14 <- #160
           DO ,11SUB#15 <- #256
           DO ,11SUB#16 <- #88
    PLEASE DO ,11SUB#17 <- #74
           DO ,11SUB#18 <- #14
           DO ,11SUB#19 <- #128
           DO ,11SUB#20 <- #114
    PLEASE DO ,11SUB#21 <- #214
           DO ,11SUB#22 <- #24
           DO ,11SUB#23 <- #112
           DO ,11SUB#24 <- #162
    PLEASE DO ,11SUB#25 <- #22
           DO ,11SUB#26 <- #104
           DO ,11SUB#27 <- #80
           DO ,11SUB#28 <- #256
    PLEASE DO ,11SUB#29 <- #2
           DO ,11SUB#30 <- #228
    PLEASE DO ,12 <- #49
    PLEASE DO ,12SUB#1 <- #76
           DO ,12SUB#2 <- #190
           DO ,12SUB#3 <- #80
           DO ,12SUB#4 <- #200
    PLEASE DO ,12SUB#5 <- #256
           DO ,12SUB#6 <- #248
           DO ,12SUB#7 <- #144
           DO ,12SUB#8 <- #216
    PLEASE DO ,12SUB#9 <- #202
           DO ,12SUB#10 <- #14
           DO ,12SUB#11 <- #144
           DO ,12SUB#12 <- #98
    PLEASE DO ,12SUB#13 <- #190
           DO ,12SUB#14 <- #160
           DO ,12SUB#15 <- #256
           DO ,12SUB#16 <- #88
    PLEASE DO ,12SUB#17 <- #218
           DO ,12SUB#18 <- #36
           DO ,12SUB#19 <- #38
           DO ,12SUB#20 <- #164
    PLEASE DO ,12SUB#21 <- #176
           DO ,12SUB#22 <- #48
           DO ,12SUB#23 <- #162
           DO ,12SUB#24 <- #14
    PLEASE DO ,12SUB#25 <- #128
           DO ,12SUB#26 <- #208
           DO ,12SUB#27 <- #162
           DO ,12SUB#28 <- #222
    PLEASE DO ,12SUB#29 <- #48
           DO ,12SUB#30 <- #8
           DO ,12SUB#31 <- #120
           DO ,12SUB#32 <- #66
    PLEASE DO ,12SUB#33 <- #48
           DO ,12SUB#34 <- #246
           DO ,12SUB#35 <- #136
           DO ,12SUB#36 <- #184
    PLEASE DO ,12SUB#37 <- #256
           DO ,12SUB#38 <- #202
           DO ,12SUB#39 <- #110
           DO ,12SUB#40 <- #104
    PLEASE DO ,12SUB#41 <- #42
           DO ,12SUB#42 <- #126
           DO ,12SUB#43 <- #56
           DO ,12SUB#44 <- #88
    PLEASE DO ,12SUB#45 <- #72
           DO ,12SUB#46 <- #56
           DO ,12SUB#47 <- #80
           DO ,12SUB#48 <- #242
    PLEASE DO ,12SUB#49 <- #228
    PLEASE DO ,13 <- #31
    PLEASE DO ,13SUB#1 <- #76
           DO ,13SUB#2 <- #190
           DO ,13SUB#3 <- #80
           DO ,13SUB#4 <- #200
    PLEASE DO ,13SUB#5 <- #256
           DO ,13SUB#6 <- #248
           DO ,13SUB#7 <- #144
           DO ,13SUB#8 <- #216
    PLEASE DO ,13SUB#9 <- #202
           DO ,13SUB#10 <- #14
           DO ,13SUB#11 <- #144
           DO ,13SUB#12 <- #98
    PLEASE DO ,13SUB#13 <- #190
           DO ,13SUB#14 <- #160
           DO ,13SUB#15 <- #256
           DO ,13SUB#16 <- #88
    PLEASE DO ,13SUB#17 <- #74
           DO ,13SUB#18 <- #14
           DO ,13SUB#19 <- #128
           DO ,13SUB#20 <- #114
    PLEASE DO ,13SUB#21 <- #214
           DO ,13SUB#22 <- #24
           DO ,13SUB#23 <- #112
           DO ,13SUB#24 <- #162
    PLEASE DO ,13SUB#25 <- #22
           DO ,13SUB#26 <- #104
           DO ,13SUB#27 <- #80
           DO ,13SUB#28 <- #256
    PLEASE DO ,13SUB#29 <- #194
           DO ,13SUB#30 <- #36
           DO ,13SUB#31 <- #256
    PLEASE DO ,20 <- #10
    PLEASE DO ,20 SUB #1 <- #76
           DO ,20 SUB #2 <- #196
           DO ,20 SUB #3 <- #4
           DO ,20 SUB #4 <- #132
    PLEASE DO ,20 SUB #5 <- #36
           DO ,20 SUB #6 <- #164
           DO ,20 SUB #7 <- #228
           DO ,20 SUB #8 <- #100
    PLEASE DO ,20 SUB #9 <- #52
           DO ,20 SUB #10 <- #180
    PLEASE DO ,21 <- #10 BY #10
    PLEASE DO ,21SUB#1#1 <- #248
    PLEASE DO ,21SUB#1#2 <- #120
    PLEASE DO ,21SUB#1#3 <- #184
    PLEASE DO ,21SUB#1#4 <- #56
    PLEASE DO ,21SUB#1#5 <- #216
    PLEASE DO ,21SUB#1#6 <- #88
    PLEASE DO ,21SUB#1#7 <- #152
    PLEASE DO ,21SUB#1#8 <- #24
    PLEASE DO ,21SUB#1#9 <- #232
    PLEASE DO ,21SUB#1#10 <- #104
           DO ,21SUB#2#1 <- #128
           DO ,21SUB#2#2 <- #256
           DO ,21SUB#2#3 <- #64
           DO ,21SUB#2#4 <- #192
           DO ,21SUB#2#5 <- #96
           DO ,21SUB#2#6 <- #224
           DO ,21SUB#2#7 <- #32
           DO ,21SUB#2#8 <- #160
           DO ,21SUB#2#9 <- #112
           DO ,21SUB#2#10 <- #240
           DO ,21SUB#3#1 <- #64
           DO ,21SUB#3#2 <- #192
           DO ,21SUB#3#3 <- #256
           DO ,21SUB#3#4 <- #128
           DO ,21SUB#3#5 <- #32
           DO ,21SUB#3#6 <- #160
           DO ,21SUB#3#7 <- #224
           DO ,21SUB#3#8 <- #96
           DO ,21SUB#3#9 <- #48
           DO ,21SUB#3#10 <- #176
           DO ,21SUB#4#1 <- #192
           DO ,21SUB#4#2 <- #64
           DO ,21SUB#4#3 <- #128
           DO ,21SUB#4#4 <- #256
           DO ,21SUB#4#5 <- #160
           DO ,21SUB#4#6 <- #32
           DO ,21SUB#4#7 <- #96
           DO ,21SUB#4#8 <- #224
           DO ,21SUB#4#9 <- #176
           DO ,21SUB#4#10 <- #48
    PLEASE DO ,21SUB#5#1 <- #32
    PLEASE DO ,21SUB#5#2 <- #160
    PLEASE DO ,21SUB#5#3 <- #224
    PLEASE DO ,21SUB#5#4 <- #96
    PLEASE DO ,21SUB#5#5 <- #256
    PLEASE DO ,21SUB#5#6 <- #128
    PLEASE DO ,21SUB#5#7 <- #192
    PLEASE DO ,21SUB#5#8 <- #64
    PLEASE DO ,21SUB#5#9 <- #16
    PLEASE DO ,21SUB#5#10 <- #144
           DO ,21SUB#6#1 <- #160
           DO ,21SUB#6#2 <- #32
           DO ,21SUB#6#3 <- #96
           DO ,21SUB#6#4 <- #224
           DO ,21SUB#6#5 <- #128
           DO ,21SUB#6#6 <- #256
           DO ,21SUB#6#7 <- #64
           DO ,21SUB#6#8 <- #192
           DO ,21SUB#6#9 <- #144
           DO ,21SUB#6#10 <- #16
           DO ,21SUB#7#1 <- #96
           DO ,21SUB#7#2 <- #224
           DO ,21SUB#7#3 <- #32
           DO ,21SUB#7#4 <- #160
           DO ,21SUB#7#5 <- #64
           DO ,21SUB#7#6 <- #192
           DO ,21SUB#7#7 <- #256
           DO ,21SUB#7#8 <- #128
           DO ,21SUB#7#9 <- #80
           DO ,21SUB#7#10 <- #208
           DO ,21SUB#8#1 <- #224
           DO ,21SUB#8#2 <- #96
           DO ,21SUB#8#3 <- #160
           DO ,21SUB#8#4 <- #32
           DO ,21SUB#8#5 <- #192
           DO ,21SUB#8#6 <- #64
           DO ,21SUB#8#7 <- #128
           DO ,21SUB#8#8 <- #256
           DO ,21SUB#8#9 <- #208
           DO ,21SUB#8#10 <- #80
    PLEASE DO ,21SUB#9#1 <- #16
    PLEASE DO ,21SUB#9#2 <- #144
    PLEASE DO ,21SUB#9#3 <- #208
    PLEASE DO ,21SUB#9#4 <- #80
    PLEASE DO ,21SUB#9#5 <- #240
    PLEASE DO ,21SUB#9#6 <- #112
    PLEASE DO ,21SUB#9#7 <- #176
    PLEASE DO ,21SUB#9#8 <- #48
    PLEASE DO ,21SUB#9#9 <- #256
    PLEASE DO ,21SUB#9#10 <- #128
           DO ,21SUB#10#1 <- #144
           DO ,21SUB#10#2 <- #16
           DO ,21SUB#10#3 <- #80
           DO ,21SUB#10#4 <- #208
           DO ,21SUB#10#5 <- #112
           DO ,21SUB#10#6 <- #240
           DO ,21SUB#10#7 <- #48
           DO ,21SUB#10#8 <- #176
           DO ,21SUB#10#9 <- #128
           DO ,21SUB#10#10 <- #256
    PLEASE DO ,22 <- #10
    PLEASE DO ,22 SUB #1 <- #8
           DO ,22 SUB #2 <- #136
           DO ,22 SUB #3 <- #72
           DO ,22 SUB #4 <- #200
    PLEASE DO ,22 SUB #5 <- #40
           DO ,22 SUB #6 <- #168
           DO ,22 SUB #7 <- #104
           DO ,22 SUB #8 <- #232
    PLEASE DO ,22 SUB #9 <- #24
           DO ,22 SUB #10 <- #152
           DO .10 <- #9
           DO .11 <- #9
    PLEASE DO ,10 <- #1
    PLEASE DO ,10SUB#1 <- #176
           DO READ OUT ,10		
           DO COME FROM (999)	
           DO (500) NEXT		
    PLEASE DO ,11SUB#1 <- .5	
           DO READ OUT ,11
           DO (500) NEXT		
           DO ,12SUB#1 <- .5	
    PLEASE DO READ OUT ,12
    PLEASE DO .6 <- '?"!10~.10'~#1"$#1'~#3
           DO (50) NEXT
    PLEASE DO .7 <- '?"!11~.11'~#1"$#1'~#3		
           DO (70) NEXT
           DO .2 <- #1
           DO .1 <- .11
    PLEASE DO (1010) NEXT		
           DO .11 <- .3
           DO (600) NEXT		
           DO (101) NEXT		
    (70)   DO (71) NEXT
           DO .11 <- #9		
           DO .2 <- #1
    PLEASE DO .1 <- .10
           DO (1010) NEXT		
           DO .10 <- .3
           DO (600) NEXT		
           DO (101) NEXT		
    (71)   DO RESUME .7		
    (50)   DO (51) NEXT
    PLEASE DO FORGET #1
           DO .2 <- #1
           DO .1 <- .11
    PLEASE DO (1010) NEXT		
           DO .11 <- .3
           DO (600) NEXT		
    PLEASE DO .7 <- '?"!11~.11'~#1"$#1'~#3		
           DO (80) NEXT
           DO (101) NEXT
    (80)   DO (81) NEXT
           DO GIVE UP
    (81)   DO RESUME .7
    (51)   DO RESUME .6		
    (101) DO FORGET #1
    (999) DO FORGET #1		
    (600)  DO (500) NEXT		
           DO ,13SUB#1 <- .5	
           DO READ OUT ,13	
           DO RESUME #1
    (500)  DO ,30 <- #1		
           DO .1 <- .10		
           DO (1020) NEXT		
    PLEASE DO ,30SUB#1 <- ,20SUB.1  
           DO READ OUT ,30		
           DO .3 <- .1		
           DO .1 <- .11		
           DO (1020) NEXT		
    PLEASE DO ,30SUB#1 <- ,21SUB .3 .1  
           DO READ OUT ,30		
           DO .5 <- ,22SUB.1	
    PLEASE DO RESUME #1		
    

    Icon

    # Scott E Gilbert <scott@cs.arizona.edu>
    procedure main()
      t:= table("bottles")
      t[1]:= "bottle"
      every n:= 100 to 1 by -1 do {
        write(n, " ", t[n], " of beer on the wall.\n",
          n, " ", t[n], " of beer.\n",
          "Take one down, Pass it around.\n",
          n-1, " ", t[n-1], " of beer on the wall.\n"
        )
      }
    end
    

    MATLAB

    Click for more information.
    % MATLAB verion of 99 Bottles of beer
    % by Bill Becker
    
    function beer(n);
    if nargin<1, n=99; end
    for i=n:-1:1,
      disp([int2str(i) ' Bottles of beer on the wall,'])
      disp([int2str(i) ' Bottles of beer,'])
      disp('Take one down and pass it around,')
      if i>1, disp([int2str(i-1) ' Bottles of beer on the wall.']),end
      end
    disp('No more bottles of beer on the wall!')
    
    Here is a version contributed that shows the language in its more "native" form. (Cf. C++)
    % MATLAB *vectorized* version of "99 bottles of beer"
    % Rich Stein (rich@cs.umbc.edu)
    
    bottles = [98:-1:3]; % bottles 98 to 3 (99, 2 & 1 are treated as special case)
    lines = 3; % need the number of bottles at the beginning of 3 lines
    
    num_array = ones(lines,1) * bottles; % bottles is a (1x96) array
    
    format_plural1 = '%d bottles of beer on the wall,\n%d bottles of beer,\n';
    format_plural2 = 'Take one down, pass it around,\n%d bottles of beer on the wall.\n\n';
    format_sing1 = '%d bottle of beer on the wall,\n%d bottle of beer,\n';
    format_sing2 = 'Take one down, pass it around,\n%d bottle of beer on the wall.\n\n';
    format_none2 = 'Take it down, pass it around,\nNo bottles of beer on the wall.\n';
    
    % bottles 99, 2 & 1 are treated as special cases
    fprintf([format_plural1 format_plural2], 99,99,num_array,2)
    fprintf([format_plural1 format_sing2], 2,2,1)
    fprintf([format_sing1 format_none2], 1,1)
    
    

    Microsoft Word

    The scripting language used for Microsoft Word
    Sub MAIN
    REM "99 bottles of beer on the wall"
    REM Microsoft Word WordBasic macro language version
    REM written by Mark Pilgrim, f8dy@netaxs.com
    FileNew
    beer$ = "99"
    bottle$ = " bottles "
    For  count = 99 To 1 Step - 1
      Insert beer$ + bottle$ + "of beer on the wall,"
      InsertPara
      Insert beer$ + bottle$ + "of beer,"
      InsertPara
      Insert "Take "
      If count > 1 Then
        Insert "one"
      Else
        Insert "it"
      End If
      Insert " down, pass it around,"
      InsertPara
      If count > 1 Then
        beer$ = Str$(count - 1)
        beer$ = Right$(beer$, Len(beer$) - 1)
        If count = 2 Then bottle$ = " bottle "
        Insert beer$ + bottle$ + "of beer on the wall."
        InsertPara
      Else
        Insert "No more bottles of beer on the wall."
      End If
      InsertPara
    Next
    End Sub
    

    Mathematica

    Mathematica is a computer algebra system.
    (* Mathematica version of 99 Bottles of Beer *)
    (* Bill Dall *)
    Do[If[i>1,
         Print[i, " more bottles of beer on the wall. ",i,
               " more bottles of beer."];
         Print["Take one down, pass it around."], 
         (* else *)
         Print["1 more bottle of beer on the wall. 1 more bottle of beer."]; 
         Print["Take one down, pass it around."];
         Print["No more bottles of beer on the wall."] 
         ], (* If *)
       {i,99,1,-1}]
    

    Logo

    Logo is a simple language, suitable for teaching and famed for its "turtle" graphics. More info
    ; by Augusto Chioccariello
    to 99bottles
    for [i 99 1 -1] [
       print se :i [bottle(s) of beer on the wall]
       print se :i [bottle(s) of beer]
       print [take one down, pass it around]
       print se (:i - 1) [bottle(s) of beer on the wall]]
    end
    

    Mops

    Mops is a Forth-based OOP freeware package for developing Macintosh applications.
    \ Mops Beer (object paradigm)
    \ by Bruce Bennett
    
    :class BEER super{ object }
    
    record{
              var   n
    }
    
    private
    
    :m lastBottle:
            cr ." 1 last bottle of beer on the wall," cr
            ." Only 1 bottle of beer." cr
            ." Take it down, pass it around --" cr
            ." No more bottles of beer!" cr
    ;m
    
    public
    
    :m bottlesOf: { n -- }
            1 n DO
                i 1 = IF lastBottle: self LEAVE THEN cr
                i . ." bottles of beer on the wall," cr
                i . ." bottles of beer." cr
                ." Take one down, pass it around," cr
                i 2 = IF i 1 - . ." last bottle of beer." ELSE
                i 1 -  . ." bottles of beer on the wall." THEN cr
            -1 +LOOP
    ;m
    
    ;class
    
    beer    beer!
    
    99 bottlesOf: beer!
    

    M5

    !rem 99 bottles of beer in the M5 macro language
    !rem programmer Ron Franke-Polz - ronaldFP@aol.com
    !rem
    !rem define a macro which contains the song
    !rem
    !macro song
    [v $1] [if [eq $1 1] "bottle" "bottles"] of beer on the wall,
    [v $1] [if [eq $1 1] "bottle" "bottles"] of beer,
    take one down and pass it around,
    [if [eq [- $1 1] 1] "No more" [- $1 1]] [if [eq [- $1 1] 1] "bottle" "bottles"] of beer on the wall.
    
    !endm
    !rem
    !rem sing the song 99 times
    !rem
    !eval [set count 99]
    !while count
        !song (count)
        !eval [-- count]
    !endwhile
    

    IRC II

    This is the scripting language for Inter Relay Chat.
    alias bottles.start {
            while (1) {
                    @ bottles.count = 99;
                    while ( bottles.count )
                    {
                            bottles.sayonwall ,
                            bottles.say
                            echo Take one down and pass it around
                            @ bottles.count = bottles.count - 1
                            bottles.sayonwall .
                            echo
                    }
                    echo No more bottles of beer on the wall,
                    echo no more bottles of beer,
                    echo Go to the store and buy some more,
                    echo 99 bottles of beer on the wall.
                    echo
            }
    }
    
    alias bottles.sayonwall echo $bottles.count bottles of beer on the wall$0
    alias bottles.say echo $bottles.count bottles of beer,
    
    bottles.start
    

    LIFE

    LIFE is a constraint logic programming language.
    %% LIFE version of 99 Bottles of beer
    %% by Denys Duchier duchier@cs.sfu.ca
    
    how_many(0) -> "no more".
    how_many(N) -> N.
    
    action(0) -> 99  | write("Go to the store and buy some more.\n").
    action(N) -> N-1 | write("Take one down, pass it around.\n").
    
    bottles(1) -> "bottle".
    bottles(N) -> "bottles".
    
    sing(N) :-
      write(H:how_many(N)," ",B:bottles(N)," of beer on the wall, ",
            H," ",B," of beer.\n"),
      write(how_many(M:action(N))," ",bottles(M),
            " of beer on the wall.\n\n"),
      sing(M).
    

    Make

    make is technically a tool for building applications, but it's amazing what a pre-processor and recursion can do for you.
    #
    #
    # quick effort at 99 bottles program using gnu make
    #
    # the file must be called makefile.bottles
    #
    # Author: Andrew Dunstan (andrew.dunstan@its.maynick.com.au)
    #
     
    default:
            $(MAKE) -f makefile.bottles BOTTLES=99 bottles
     
    .SILENT:
     
    bottles:
            echo $(BOTTLES) bottles of beer on the wall
            echo $(BOTTLES) of beer
            echo Take one down and pass it around
    ifeq ($(BOTTLES),0)
            echo No bottles of beer on the wall
    else
            echo `expr $(BOTTLES) - 1` bottles of beer on the wall
            echo
            $(MAKE) -f makefile.bottles BOTTLES=`expr $(BOTTLES) - 1`  bottles
    endif
    

    Maple V3

    #
    # Vanilla (non-graphical) version of 99 Bottles as sung 
    # reluctantly by Maple V3, and only under the agreement that it
    # will be called on to perform the song properly, in color, and with 
    # appropriate animation... someday
    #
    # Authors: Hill and Burstall (handb@ionet.net)
    #
    lyrics:=(` Bottle`,` of beer on the wall! ` ,` of beer!  Take`, 
             ` down, pass it around...`):  
    for i from 99 by -1 to 3 do   
         print(cat ( i ,lyrics[1],`s`,lyrics[2]), 
               cat(i, lyrics[1],`s`,lyrics[3],` one`,lyrics[4]), 
               cat(i-1,lyrics[1],`s`,lyrics[2]))   
                            od;
    print(cat ( i ,lyrics[1],`s`,lyrics[2]), cat(i, lyrics[1],`s`,lyrics[3],` one`,
          lyrics[4]), cat(i-1,lyrics[1],lyrics[2]));
    print(cat ( `1` ,lyrics[1],lyrics[2]), cat(`1`, lyrics[1],lyrics[3],` it`,
          lyrics[4]), cat(`0`,lyrics[1],`s`,lyrics[2]));
    

    ML

    (* ML version of 99 bottles of beer                               *)
    (*   - Using pattern of functions parameters                      *)
    (*     and Recursion(like other functional programming langauges) *)
    
    (* Written by Jong-Won Choi(jwchoi@gsen.goldstar.co.kr)           *)
    (*                                                     Nov 13, 95 *)
    
    fun NinetyNineBottlesOfBeer(0) =
      print("\n No more bottles of beer on the wall\n")
    | NinetyNineBottlesOfBeer(1) = 
       (print("\n 1 bottle of beer on the wall, 1 bottle of beer.");
        print("\n Take one down and pass it around.");
        NinetyNineBottlesOfBeer(0))
    | NinetyNineBottlesOfBeer(NumberOfBottles:int) =
       (print("\n "); print(NumberOfBottles);
        print(" bottle of beer on the wall, ");
        print(NumberOfBottles);
        print(" bottle of beer.");
        print("\n Take one down and pass it around.");
        NinetyNineBottlesOfBeer(NumberOfBottles - 1));
    

    Mercury

    A purely declarative logic programming language. Click for more information.
    % file: beer.m
    % author: Fergus Henderson <fjh@cs.mu.oz.au>
    % date: Thursday 9th November 1995
    
    :- module beer.
    :- interface.
    :- import_module io.
    
    :- pred main(io__state::di, io__state::uo) is det.
    
    :- implementation.
    :- import_module int.
    
    main --> beer(99).
    
    :- pred beer(int::in, io__state::di, io__state::uo) is det.
    
    beer(N) -->
    	( { N = 0 } ->
    		io__write_string("Go to the store and buy some more!")
    	;
    		bottles(N),
    		io__write_string(" on the wall,\n"),
    		bottles(N),
    		io__write_string(".\n"),
    		io__write_string("Take one down, pass it around,\n"),
    		{ N1 is N - 1 },
    		bottles(N1),
    		io__write_string(" on the wall.\n\n"),
    		beer(N1)
    	).
    
    :- pred bottles(int::in, io__state::di, io__state::uo) is det.
    
    bottles(N) -->
    	( { N = 0 } ->
    		io__write_string("No more bottles of beer")
    	; { N = 1 } ->
    		io__write_string("1 bottle of beer")
    	;
    		io__write_int(N),
    		io__write_string(" bottles of beer")
    	).
    
    

    Lingo

    Lingo is Macromedia's Director scripting language.
    -- Lingo version of 99 Bottles of Beer 
    -- programmer: John R. Nyquist SynapseDes@aol.com
    
    
    on BottlesOfNABeer
      -- This handler outputs to the message window.
      
      set maxBottles to 99
      
      repeat with bottles = maxBottles down to 1
        set bottleString to WhichString(bottles)
        put bottleString & " of beer on the wall, " & bottleString & " of beer."
        put "Take one down, pass it around," 
        put WhichString(bottles - 1) & " of beer on the wall."
        put RETURN
      end repeat
      
      put "No bottles of beer on the wall, no bottles of beer."
      put "Go to the store and buy some more."
      put maxBottles & " bottles of beer on the wall."
      
    end BottlesOfNABeer
    
    
    on WhichString bottles
      
      if bottles > 1 then
        return bottles & " bottles"
      else if bottles = 1 then
        return "1 bottle"
      else
        return "No more bottles"
      end if
      
    end WhichString 
    
    

    Inform

    Inform is a compiler meant for writing adventure games for the so-called "Z-machine" created by Infocom. Click here for more information.
    ! ---------------------------------------------------------------------------
    !  99 Bottles of Beer on the Wall, Inform version [smaller]
    !       _
    !  Torbjorn Andersson, (d91tan@Minsk.DoCS.UU.SE) December 1995
    ! ---------------------------------------------------------------------------
    
    ! For technical reasons, the first function is not allowed to use local
    ! variables.
    
    Global i = 99;
    
    [ Main;
        print "^^^^";
    
        while (i > 0) {
            new_line;
            print i, (char) ' ', (PluralBottle) i, " of beer on the wall,^";
            print (Chorus) i--;
            print "You take one down & pass it around^";
            print (Chorus) i;
        }
    
        @read_char 1 i;
        quit;
    ];
    
    [ PluralBottle n;
        if (n == 1)
            print "bottle";
        else
            print "bottles";
    ];
    
    [ Chorus n;
        print "  ";
    
        if (n == 0)
            print "No more";
        else
            print n;
    
        print_ret (char) ' ', (PluralBottle) n, " of beer";
    ];
    
    end;
    
    

    Inform 6

    Inform 6 is version 6 of a compiler meant for writing adventure games for the so-called "Z-machine" created by Infocom. It seems to be more object oriented than the original sent to me. Click here for more information.
    ! -----------------------------------------------------------------------------
    ! 99 Bottles of Beer on the Wall, Inform 6 version.
    !
    ! Torbjörn Andersson, (d91tan@Student.DoCS.UU.SE), August 1997
    ! -----------------------------------------------------------------------------
    
    Constant NUM_BOTTLES	99;
    
    Object wall
      private
    	bottles_left,
      with	init [ n;
    	    self.bottles_left = n;
    	],
    	bottle_name [;
    	    if (self.bottles_left == 1)
    		return "bottle";
    
    	    return "bottles";
    	],
    	bottle_count [;
    	    return self.bottles_left;
    	],
    	take_one_down [;
    	    self.bottles_left--;
    	];
    
    [ Main;
        wall.init(NUM_BOTTLES);
    
        while (wall.bottle_count() > 0) {
    	print
    	    "^",
    	    wall.bottle_count(), " ", (string) wall.bottle_name(),
    	    " of beer on the wall,^  ",
    	    wall.bottle_count(), " ", (string) wall.bottle_name(),
    	    " of beer^You take one down and pass it around^  ";
    
    	wall.take_one_down();
    
    	if (wall.bottle_count() == 0)
    	    print "No more";
    	else
    	    print wall.bottle_count();
    
    	print " ", (string) wall.bottle_name(), " of beer on the wall.^";
        }
    ];
    

    KidSim

    This is cool, but I couldn't really include the code for it here. Click here for more information, including an animation of 99BoB's.


    IDL

    ; The Bottles of Beer song (c) 1996 Eric Korpela (korpela@ssl.berkeley.edu)
    ; USAGE:  BOTTLES or BOTTLES, NUMBER
    ;
    pro bottles, number
    ;
    if not(keyword_set(number)) then begin
      number=99
      print,'BOTTLES: Defaulting to 99 bottles!'
    endif
    ;
    ; Set up our song structure............
    st1=replicate({n0:0,s1:' bottles of beer on the wall.',          $
                   n1:0,s2:' bottles of beer.',                      $
                   s3:'You take one down and pass it around.',       $
                   n2:0,s4:' bottles of beer on the wall.'}, number)
    ;
    ; put in the appropriate numbers
    i=(number-1)-indgen(number)
    st1(*).n0=i+1
    st1(*).n1=i+1
    st1(*).n2=i
    ;
    print,st1,format='(i3,a/i3,a/a/i3,a//)'
    ;
    end
    

    MAGIC/L

    A procedural language written in Forth. Originally ran on Z80's under CP/M and later available for IBM-PCs and Sun 3s.
    ; MAGIC/L version of the beer bottle song 
    ; (c) 1996 Eric Korpela (korpela@ssl.berkeley.edu)
    ; WARNING! All the spaces are necessary!
    ;
    ; Add the help entry....
    .subject bottles
    Usage:  bottles ( number )
    .
    ; and here's the procedure
    define bottles 
      integer number
      local integer current
    ;
      current := number
      while ( current > 1 )
        print current , " bottles of beer on the wall."
        print current , " bottles of beer."
        print "You take one down and pass it around."
        current := current - 1
        print current , " bottles of beer on the wall."
        print
      repeat
    ;
      print 1 , " bottle of beer on the wall."
      print 1 , " bottle of beer."
      print "You take one down and pass it around."
      print "No bottles of beer on the wall.
    end
    

    Meta-HTML

    <html>
    <head> <title> 99 Bottles of Beer: The Compleat Lyrics </title> </head>
    <body>
    
    ;;;
    ;;; The actual source code to The Compleat Lyrics.
    <defsubst plural whitespace=delete>
      <if <not <eq %0 1>> s>
    </defsubst>
    
    <set-var beers=99>
    <while <gt beers 0>>
      <get-var beers> bottle<plural beers> of beer on the wall, <br>
      <get-var beers> bottle<plural beers> of beer, <br>
      You take one down, pass it around, <br>
      <decrement beers>
      <get-var beers> bottle<plural beers> of beer on the wall.
      <p>
    </while>
    
    No more bottles of beer on the wall, <br>
    No more bottles of beer, <br>
    Go to the store, and buy some more, <br>
    
    <form method=GET action="<get-var mhtml::current-url>">
      <input type="submit" name="button" value="99 Bottles of beer on the wall">
    </form>
    
    </body>
    </html>
    

    MUSH/TinyTIM/TinyMUSH

    Heaven help us! Stuff to program multi-user games on the net.
    A bunch of drunk engineers(#54326)
    Owner: eric.korpela Key: eric.korpela(#54351PeoZ)  Money: 2
    You see a bunch of engineers from a south bay firm who look like they've had a 
    bit too much to drink. They are random walking all over town, stopping where 
    ever they can find approprate beverages. I bet they'd sing "99 bottles of 
    beer" if you asked them to.
    
    Listen: *sing*99*
    
    Ahear: use me;
           @wait 3={
              @while gt(V(vi),1)={
                @if eq(V(vj),V(vi))=think,{@trigger me/vy;@decrement me/vj}
              };
              @wait DONE=:collapses into an algoholic stupor.
           }
    
    VY: say concat(V(vi),bottles of beer on the wall!); 
        say concat(V(vi),bottles of beer.); 
        say You take one down, and pass it around; 
        @decrement me/vi; 
        say concat(V(vi),bottles of beer on the wall.);
        @emit
    
    Ause: @vi me=99;@vj me=100
    
    Ouse: takes a deep breath and begins to sing.
    
    Scent: They smell of 43 different types of liquor.
    
    Functions: #69
    

    KUIP

    *******************************************
    * KUIP version of 99 bottles of beer      *
    * r.p.hofmann f15rph@ips105.desy.de       *
    * http://ips105.desy.de:8765/             *
    *******************************************
    * about KUIP:                             *
    * R.Brun, P.Zanarini                      *
    * KUIP - Kit for a User Interface Package *
    * Program library I202. CERN 1988         *
    *******************************************
    
    macro beer nbott=99 ndown=1
    
      if [ndown] > 0 goto ndok
      ndown=-[ndown]
    ndok:
      if [ndown] > 1 goto mored
      alias/create pron it
      goto oned
    mored:
      alias/create pron them
    oned:
      if [nbott] < 1 goto end
      if [nbott] = 1 goto one
      alias/create bob 'bottles of beer'
      alias/create otw 'on the wall'
    pass:
      mess [nbott] bob otw
      mess [nbott] bob
      mess take [ndown] down and pass pron all around 
      nbott=[nbott]-[ndown]
      if [nbott] <> 1 goto moreb
      mess 1 bottle of beer otw
      goto oneb
    moreb:  
      mess [nbott] bob otw
    oneb:
      if [ndown] = 0 goto end
      if [nbott] > 1 goto pass
      if [nbott] < 1 goto end
    one:
      mess 1 bottle of beer otw
      mess 1 bottle of beer
      mess take [ndown] down and pass pron all around
      nbott=1-[ndown]
      mess [nbott] bottles of beer otw
      if [nbott] < 1 goto end
    end:
    

    MOO

    @args #230:"@99" none none none
    @chmod #230:@99 rxd
    @program #230:@99
    "Programmed by Malcolm Gin-Hopwood y Silva (perigee@dgsys.com)";
    "Runs on LambdaMOO core 1.7.9 and 1.8.0";
    "This one spares any standers by the terror of 99 bottles of beer on the wall,
    and does numbers to english passing as well.  Woo woo.";
    count = 99;
    while (count > 0)
      $command_utils:suspend_if_needed(0);
      this:_round_of_beer(count);
      count = count - 1;
    endwhile
    player:tell("Time to buy more beer.");
    .
    
    @args #230:"_round_of_beer" this none this
    @program #230:_round_of_beer
    beer = args[1];
    player:tell(($string_utils:capitalize($string_utils:english_number(beer)) +
    ((beer == 1) ? " bottle " | " bottles ")) + "of beer on the wall.");
    player:tell(($string_utils:capitalize($string_utils:english_number(beer)) +
    ((beer == 1) ? " bottle " | " bottles ")) + "of beer...");
    player:tell("Take one down and pass it around.");
    player:tell(($string_utils:capitalize($string_utils:english_number(beer - 1))
    + (((beer - 1) == 1) ? " bottle " | " bottles ")) + "of beer on the wall.");
    player:tell();
    .
    

    Mark IV

    BEER    RCDUMMYFD S U   S    T      R                                           
    BEER    RFSUBFILE SM4SUBF1                                                      
    BEER    ERDATE                                                                  
    BEER    AA
    BEER    AA   Michael Passer
    BEER    AA
    BEER    AA   This program requires one dummy record of input
    BEER    AA   (the M4OLD DD) to trigger execution.  Output is
    BEER    AA   sent to the first subfile (M4SUBF1 DD).
    BEER    AA
    BEER    TFBOTTLESZ  3Z      100
    BEER    AA                  ----+----1----+- 
    BEER    TFBOB      15C      BOTTLES OF BEER                                     
    BEER    TFOTW      11C      ON THE WALL                                         
    BEER    TFTOD      13C      TAKE ONE DOWN                                       
    BEER    TFPIA      14C      PASS IT AROUND                                      
    BEER    TFCOMMA     1C      ,                                                   
    BEER    TFPERIOD    1C      .                                                   
    BEER    TFBLANK     1C                                                          
    BEER    PR              GO SUB SING                                             
    SING    ERDATE                                         S          100           
    SING    PR     TBOTTLESZEQD0                                                    
    SING    PR              GS RETURN                                               
    SING    PR              GO SUB CHORUS                                           
    SING    PR              R TMINUS1Z                        TBOTTLESZ             
    SING    PR              GO REQUEST SING                                         
    CHORUS  ERDATE                                         S                        
    CHORUS  TFMINUS1Z   3Z                                                          
    CHORUS  TFBOTTLES   3C                                                          
    CHORUS  TFMINUS1    2C                                                          
    CHORUS  PR     TBOTTLESZ- D1                              TMINUS1Z              
    CHORUS  PR              R TBOTTLESZ                       TBOTTLES              
    CHORUS  PR              R TMINUS1Z                        TMINUS1               
    CHORUS  E1                              NR SUBFILE     V                        
    CHORUS  R1     TBOTTLES                                                         
    CHORUS  R1     TBLANK                                                           
    CHORUS  R1     TBOB                                                             
    CHORUS  R1     TBLANK                                                           
    CHORUS  R1     TOTW                                                             
    CHORUS  R1     TCOMMA                                                           
    CHORUS  E2                              NR SUBFILE     V                        
    CHORUS  R2     TBOTTLES                                                         
    CHORUS  R2     TBLANK                                                           
    CHORUS  R2     TBOB                                                             
    CHORUS  R2     TCOMMA                                                           
    CHORUS  E3                              NR SUBFILE     V                        
    CHORUS  R3     TTOD                                                             
    CHORUS  R3     TCOMMA                                                           
    CHORUS  R3     TBLANK                                                           
    CHORUS  R3     TPIA                                                             
    CHORUS  R3     TCOMMA                                                           
    CHORUS  E4                              NR SUBFILE     V                        
    CHORUS  R4     TMINUS1                                                          
    CHORUS  R4     TBLANK                                                           
    CHORUS  R4     TBOB                                                             
    CHORUS  R4     TBLANK                                                           
    CHORUS  R4     TOTW                                                             
    CHORUS  R4     TPERIOD                                                          
    CHORUS  E5                              NR SUBFILE     V                        
    CHORUS  R5     TBLANK                                                           
    

    ISM/SML

    SML is the language used in ISM/Openmaster, the BULL Administrative Platform. ISM/SML (for Integrated System Management / System Management Language).
    ; Code Begin
    ; A.Brunet@frcl.bull.fr (Alain Brunet)
    
    (defun beer(cap)
      (dotimes (i cap)
        (print (- cap i) " bottle" (if (= i (- cap 1)) "" "s") " of beer on the wall.")
        (print "Take one down, pass it around.\n")
      )
      (print "Time to buy more beer !")
    )
    
    (beer 99)
    

    Korn Shell

    Yet another UN*X shell.
    #!/bin/ksh
    # Korn shell version of 99 Bottles
    # Dave Plonka - plonka@carroll1.cc.edu
    
    typeset -i n=99
    typeset bottles=bottles
    typeset no
    
    while (( n ))
    do
       print "${n?} ${bottles?} of beer on the wall,"
       print "${n?} ${bottles?} of beer,\ntake one down, pass it around,"
       n=n-1
       case ${n?} in
       0)
          no=no
          bottles=${bottles%s}s
          ;;
       1)
          bottles=${bottles%s}
          ;;
       esac
       print "${no:-${n}} ${bottles?} of beer on the wall.\n"
    done
    
    exit
    

    LabVIEW

    An icon based language. Click for more information

    Leda

    Leda is a multiparadigm programming language designed by Timothy A. Budd. It supports imperative, object-oriented, functional and logic programming paradigms. Click here for Information and an interpreter.
    { 99 bottles of beer, Leda version  }
    { By Arion Lei (philipl@cs.ust.hk)  }
    
    include "std.led";
    
    const
      verse1 := " bottles of beer on the wall,\n";
      verse2 := " bottles of beer.  Take one down, pass it around,\n";
      verse3 := " bottles of beer on the wall.\n";
      verse4 := "No more bottles of beer on the wall, no more bottles of beer.\n";
      verse5 := "Go to the store and buy some more... 99 bottles of beer.\n\n";
    
    { ========== IMPERATIVE PROGRAMMING =========== }
    
    function proc_Beer (bottleTotal : integer);
    var bottleLeft : integer;
    begin
      bottleLeft := bottleTotal;
      while bottleLeft>0 do begin
        print(bottleLeft);  print(verse1);
        print(bottleLeft);  print(verse2);
        bottleLeft := bottleLeft - 1;
        if (bottleLeft>0) then begin
          print(bottleLeft);  print(verse3);
        end;
      end;
      print(verse4);
      print(verse5);
    end; { proc_Beer }
    
    
    { ========== OBJECT-ORIENTED PROGRAMMING =========== }
    
    class Beers;
    var
      bottleLeft : integer;
    
      function more () -> boolean;
      begin
        return bottleLeft > 0;
      end;
    
      function consume1 ();
      begin
        print(bottleLeft);  print(verse1);
        print(bottleLeft);  print(verse2);
        bottleLeft := bottleLeft - 1;
        if (bottleLeft>0) then begin
          print(bottleLeft);  print(verse3);
        end else begin
          print(verse4);
          print(verse5);
        end;
      end;
    end; { class Beers }
    
    function obj_Beer (bottleTotal : integer);
    var obeer : Beers;
    begin
      obeer := Beers(bottleTotal);
      while (obeer.more()) do obeer.consume1();
    end; { obj_Beer }
    
    
    { ========== FUNCTIONAL PROGRAMMING =========== }
    
    function func_Beer (num : integer) -> function();
    begin
      return function ();
        begin
          print(num);  print(verse1);
          print(num);  print(verse2);
          if num>1 then begin
            print(num-1);  print(verse3);
            func_Beer(num-1)();
          end else begin
            print(verse4);
            print(verse5);
          end;
        end;
    end; { func_Beer }
    
    
    { ========== LOGIC PROGRAMMING =========== }
    
    function log_Beer (bottleTotal : integer);
    
      function pickBottle (byRef left : integer, total : integer)->relation;
      begin
        if total = 0 then 
          return false
        else 
          return left <- total | pickBottle(left, total-1);
      end;
      
      function consume (i : integer)->relation;
      begin
        print(i);  print(verse1);
        print(i);  print(verse2);
        if i>1 then begin
          print(i-1); print(verse3);
        end else begin
          print(verse4);
          print(verse5);
        end;
        return true;
      end;
    
    var i : integer;
    begin
      for pickBottle(i, bottleTotal) & consume(i) do begin end;
    end; { log_Beer }
    
    
    { ---------- MAIN PROGRAM ---------- }
    
    var bottleTotal : integer;
    
    begin
      bottleTotal := 99;
      proc_Beer (bottleTotal);
      obj_Beer (bottleTotal);
      func_Beer(bottleTotal)();
      log_Beer(bottleTotal);
    end;
    

    Limbo

    Limbo is compiler for Lucent Technologies new Inferno Operating System.
    implement BeerBottles;
    
    include "sys.m";
    	sys: Sys;
    include "draw.m";
    	draw: Draw;
    
    BeerBottles: module
    {
    	init: fn(ctxt: ref Draw->Context, agv: list of string);
    };
    
    init(ctxt: ref Draw->Context, argv: list of string)
    {
    	sys = load Sys Sys->PATH;
    	for (int bottles = 99; bottles > 0; bottles--) {
    		sys->print("%d bottle(s) of beer on the wall,\n",bottles);
    		sys->print("%d bottle(s) of beer.\n",bottles);
    		sys->print("Take one down, pass it around,\n");
    		sys->print("%d bottle(s) of beer on the wall.\n\n");
    	}
    }
    

    M-Speak

    M-Speak is a word-processing macro language created in the late 1970's for the Spellbinder word processor.
    ;-)   Spellbinder Macro to print "99 Bottles of Beer on the Wall"   (-;
    ; by Andy Goldberg
    ;
    :%A="s"                                         ;set variable for plural
    :%1=99                                          ;initialize counter
    :%2=%1-1                                        ;decrement at top of loop
    s//%1 bottle%A of beer on the wall</            ;lyric
    s//%1 bottle%A of beer</<
    s//Take one down and pass it around</
    :on %2-1 /+4 / /+1                              ;check for last stanza
    :%A=""                                          ;if last stanza clear plural
    s//%2 bottle%A of beer on the wall.<</          ;last line and blank line
    :%1=%1-1                                        ;check for end
    :on -1 /-9                                      ;if not end then loop
    s//No more bottles of beer on the wall.</       ;ending line  
    /t/p/wo/song.txt/t/gd                           ;print, save and end (optional)
    

    MetaPost

    For more information on MetaPost see http://cm.bell-labs.com/who/hobby/MetaPost.html
    % MetaFont/MetaPost version of ``99 bottles'' by Tomasz J. Cholewo
    % For more information see http://cm.bell-labs.com/who/hobby/MetaPost.html
    for i:=99 downto 1:
      message decimal i & " bottle" if i>1: & "s" fi & " of beer on the wall,";
      message decimal i & " bottle" if i>1: & "s" fi & " of beer.";
      message "Take one down, pass it around.";
    endfor;
    message "No more bottles of beer on the wall.";
    end
    

    ILE AS/400

    This is IBM's next generation of RPG.
    H*
    H*  ILE RPG/400 - 99 Bottles of Beer on the Wall.
    H*  (IBM AS/400 Midrange Platform)
    H*  (Program Source BOTTLESR1)
    H*
    FBottlesS1 O    E             WorkStn
    C
    C                   Z-Add     *HIVAL        Bottles1
    C
    C                   DoW       Bottles1 > *Zero
    C                   Eval      Bottles2 = Bottles1
    C                   Write     #Display
    C                   Sub       1             Bottles1
    C                   EndDo
    C
    C                   Eval      *InLR = *On
    C
    
    -----------------------
    
    A*
    A*  ILE RPG/400 - 99 Bottles of Beer on the Wall.
    A*  (IBM AS/400 Midrange Platform)
    A*  (Display File Source BOTTLESS1)
    A*
    A                                      DSPSIZ(24 80 *DS3)
    A          R #DISPLAY                  FRCDTA
    A
    A            BOTTLES1       2Y 0O  4  2EDTCDE(4)
    A                                  4  5'Bottles of Beer On the Wall,'
    A            BOTTLES2       2Y 0O  4 34EDTCDE(4)
    A                                  4 37'Bottles of Beer,'
    A                                  5  2'Take one down, pass it around.'
    A
    

    MPTMON

    ; MPTMON (Multi Processor Test Monitor) is a debugging
    ; tool for telephonic exchanges from Alcatel.
    ; These two macros do the beer job..
    REM MAC Bottle
    DEF MAC Bottle
      WR %0,' Bottle',&
      IF %0<>1\'s',&
      END
      ' of Beer',&
      IF %1\' on the Wall',&
      END
      '%2'
    EM
    REM MAC Beer
    DEF MAC Beer ; jr_31jan97
    ADD SYM.I=99T
    BAS=T
    COU 99T
      Bottle:.I,TRUE,','
      Bottle:.I,FALSE,'.'
      '    Take one down, pass it around,'
      .I=.I-1
      Bottle:.I,TRUE,'.'
     ''
    END
    EM
    Beer:
    

    Model 204

    *Model 204 (or M204 as it's commonly called) is a proprietary
    *database and language of Computer Corporation of America.
    *It was first developed over 30 years ago by the NSA.
    *Some claim that it's the fastest IBM Mainframe database.
    *It is good for databases with large record counts.
    *The Department of Social Security of Australian employs
    *hundreds of M204 programmers.
    *Add-on packages permit SQL and Web access.
    *
    * Written by Kevin Giles, NCI Information Systems Inc.
    * e-mail: KGILES@USGS.GOV
    *
    * 100 bottles of beer / take one / action
    *
    *LOWER
    BEGIN
    DECLARE %S IS STRING LEN 1 COMMON
    FOR %BOTTLE FROM 100 TO 0 BY -1
      CALL CHECKPLURAL(%BOTTLE)
      PRINT %BOTTLE AND 'bottle' WITH %S AND 'of beer on the wall.'
      PRINT %BOTTLE AND 'bottle' WITH %S AND 'of beer.'
      PRINT 'Take one down, pass it around.'
      CALL CHECKPLURAL(%BOTTLE-1)
      IF %BOTTLE-1 = +0 THEN PRINT 'No bottles of beer on the wall.'
          SKIP 1 LINE
          PRINT 'No bottles of beer on the wall.'
          PRINT 'No bottles of beer.'
          PRINT 'Go to the store, buy some more.'
          %BOTTLE = 101
          CALL CHECKPLURAL(%BOTTLE-1)
      END IF
      PRINT $UNBLANK(%BOTTLE-1) AND 'bottle' WITH %S AND -
                         'of beer on the wall.'
      SKIP 1 LINE
    END FOR
    SUBROUTINE CHECKPLURAL (%PASSVAL STRING DP 0 INPUT)
      IF %PASSVAL NE +1 THEN  %S = 's'
      ELSE                    %S = ''
      END IF
    END SUBROUTINE
    END
    

    Miranda

    || 99 bottles of beer in Miranda - the hideous functional programming lingo
    || by Tim Walls, tjw1@doc.ic.ac.uk, http://www-students.doc.ic.ac.uk/~tjw1/
    ||
    || Call with 'bottlesofbeer 99'.
    bottlesofbeer :: num -> [char]
    
    bottlesofbeer n = "\nNo more bottles of beer on the wall, \n"		
    		       ++ "no more bottles of beer.\n"	, if n = 0
    		= "\nOne more bottle of beer on the wall, one bottle of beer,\n"
    		       ++ "Take one down and pass it around"
    		       ++ (bottlesofbeer (n-1))		, if n = 1
    		= "\n" ++ shownum(n) ++ " bottles of beer on the wall,"
    		       ++ shownum(n)
    		       ++ " bottles of beer,\nTake one down and pass it around"
    		       ++ (bottlesofbeer (n-1))		, otherwise
    

    K

    s:" bottles of beer on the wall,  bottles of beer.
    If  bottles should happen to fall,
     bottles of beer on the wall.
    
    "
    d:{`0:,/|(r[];u[]),n'|3_!x+1}
    r:{k[(1;1;"that";"No more")]_di 8 39 64}
    u:{n[2]_di 105}
    n:{k(x;x;"one of those";x-1)}
    k:{,/($x),'0 30 51 83_ s}
    

    Lakota

    Lakota is a shell language used mainly in the TRUEchange configuration management package from True Software. Code courtesy Beirne "Bern" Konarski.
    #! /usr/local/lsh
    
    set-string s s
    set-string item one
    do i 99 1 -1
        print (i) bottle(s) of beer on the wall,
        print (i) bottle(s) of beer.
        print You take (item) down, pass it around,
        set-string j {- (i) 1}
        if {=? (j) 1}
            set-string s
            set-string item it
        if {=? (i) 1}
            print No more bottles of beer on the wall.(newline)
        else
            print (j) bottle(s) of beer on the wall.(newline)
        cycle
    

    Luck

    Luck is custom programming language. 99BoB code contributed by the creator.
    luck: Beer99
    proc: main
      new #bottles = 99
      loop: #bottles > 0
    
    saysolo #bottles
        say " bottle(s) of beer on the wall."
        saysolo
    #bottles
        say " bottle(s) of beer."
        say "Take one down and pass it
    around."
        #bottles = #bottles - 1
        if: #bottles = 0
          saysolo "No
    more"
        end
        if: #bottles > 0
          saysolo #bottles
        end
        say "
    bottle(s) of beer on the wall."
        say
      end
    end
    

    Magma

    Magma is a computer algebra system from Australia.
    verse := function(n)
        bottles := function(n)
    	return n eq 1 select "1 bottle" 
                          else IntegerToString(n) cat " bottles";
        end function;
    
        return current cat " of beer on the wall,\n" cat
    	   current cat " of beer;\n" cat
               "Take one down, pass it around,\n" cat
    	   bottles(n - 1) cat " of beer on the wall.\n\n"
    		where current is bottles(n);
    end function;
    
    song := procedure()
        print &cat [verse(n) : n in [99 .. 1 by -1]] cat 
    	  "Go to the store and get some more.";
    end procedure;
    

    Jam

    Jam is a make-like system for building programs, etc.
    # Jamfile for 99 Bottles of beer on the wall.
    # David Brandon (brandon@aspentech.com)
    
    ALWAYS beer ;
    
    rule Drink {
        for tenbeers in 9 8 7 6 5 4 3 2 1 "" {
            for beers in 9 8 7 6 5 4 3 2 1 0 {
                b = $(tenbeers)$(beers) ;
                if ( $(b) != 99 ) {
                    ECHO "$(b) bottles of $(<) on the wall!" ;
                }
                if ( $(b) = 0 ) {
                    EXIT "No more $(<)!" ;
                }
                ECHO "$(b) bottles of $(<) on the wall. $(b) bottles of $(<). Take one down," ;
                ECHO "pass it around..." ;
            }
        }
    }
    
    Drink beer ;
    

    Kermit Script

    In case you missed it, Kermit is the communications program that seems to have been ported to just about everything, from the Timex Sinclair to the Cray II.
    comment --- 99 bottles of beer, in Kermit scripting language.
    comment --- Execute by using the TAKE command in Kermit, or naming
    comment --- this file with the default initialization file name.
    comment --- 23-Sep-1997 --- Scott Snadow, snadow@eisner.decus.org
    
    set count 99
    :loop
    if < \v(count) 99 echo \v(count) bottle(s) of beer on the wall.
    echo
    echo \v(count) bottle(s) of beer on the wall, \v(count) bottle(s) of beer.
    echo Take one down, pass it around,
    if count goto loop
    echo No bottles of beer on the wall.
    

    Compilation Copyright 1995, 1996, 1997 Tim Robinson. All Rights Reserved
    Permission to copy enthusiastically granted to instructors of computer science
    (who would like to demonstrate the styles of different programming languages
    to their students) provided that the names of the contributors are retained.

    More beer
    Back to the Funhouse