99 Bottles of Beer
One program in 571 languages
 
     
  Submit new example     Change log     History     Links     Tip: internet.ls-la.net     Thanks, Oliver     Guestbook      
Choose languages starting with letter:
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
D++   D   DAL   DarkBasic   Darwin   Dataflex 2/3   DBase+   DBase 2000   DBASE III   dc   DCL (for OpenVMS)   DCL (on VAX)   DCL (on VMS)   DECTPU   Definer (Object orientated)   Definer   Delphi NonVCL   Delphi   Dialect   Dialog   DIBOL   DiNGS Game Basic   Doc1 PCE   DOS Batch   Dot Tool   DPas   Draco   DSSP   DTML   DYL 280   Dylan  
 
  Programming language: D++
 
' D++ version of 99 Bottles of beer (Bottles.dpp)
' See http://squeakmac.tripod.com/dppdownloads.html
' Philipp Winterberg, http://www.winterbergs.de

title "99 Bottles of Beer";
newvar b = 99;

do until b = 0;
  screenput b & " bottle(s) of beer on the wall,"; screen;
  screenput b & " bottle(s) of beer."; screen;
  screenput "Take one down, pass it around,"; screen;
  b--;
  screenput b & " bottle(s) of beer on the wall."; screen; screen;
  doevents;
loop
 
  Programming language: D
 
// D version of 99 Bottles of beer (Bottles.d)
// (http://www.digitalmars.com/d/index.html).
// Philipp Winterberg, http://www.winterbergs.de

int main()
{
    for (int b = 99; b > 0; b--) 
    {
        printf("%d bottle(s) of beer on the wall,\n", b);
        printf("%d bottle(s) of beer.\n", b);
        printf("Take one down, pass it around,\n");
        printf("%d bottle(s) of beer on the wall.\n\n", (b-1));
    }
    return 0;
}

 
  Programming language: DAL
 
Apple's Data Access Language

/*
DAL version of 99 Bottles of beer programmer:
by Georg Hentsch: ghentsch@blsoft.com
*/

declare integer beers = 99;
declare varchar s;

while (beers > 0)
{
	if (beers != 1)
		s = "s";
	else
		s = "";
	printf("%d bottle%s of beer on the wall,\n", beers, s);
	printf("%d bottle%s of beeeeer . . . ,\n", beers, s);
	printf("Take one down, pass it around,\n");

	beers--;
	if (beers > 0)
		printf("%d", beers);
	else
		printf("No more");
	if (beers != 1)
		s = "s";
	else
		s = "";
	printf(" bottle%s of beer on the wall.\n", s);
}
 
  Programming language: DarkBasic
 
rem DarkBasic version of 99 Bottles of beer (Bottles.dba)
rem http://www.darkbasic.com/download.php
rem Philipp Winterberg, http://www.winterbergs.de

a$=" bottle(s) of beer" : c$=" on the wall" 
for b=99 to 1 step -1
  print b, a$, c$, ","
  print b, a$, "."
  print "Take one down, pass it around,"
  print b-1, a$, c$, "."
  wait (1000) : cls rgb(0,0,0)
next b : end
 
  Programming language: Darwin
 
Some biochemists write code in a programming language called Darwin, which
is an interpreted language with support for many of the functions used 
when analyzing biological sequences. Here is '99 bottles of beer' in 
Darwin. It even handles plural.

plural := proc(num)
  if num = 1 then
    return(''):
  else
    return('s'):
  fi:  
end:

bottlesong := proc()
  for i from 99 to 1 by -1 do
    printf('%d bottle%s of beer on the wall. \n', i, plural(i)):
    printf('%d bottle%s of beer\n', i, plural(i)):
    printf('Take one down, pass it around.\n'):
    printf('%d bottle%s of beer on the wall.\n\n', i-1, plural(i-1)):
  od:
end:

bottlesong();
 
  Programming language: Dataflex 2/3
 
/*
// beer.src 
// Dataflex 2.3 
// R. Wingerter, rwingerter@t-online.de
//
		
clearscreen

number i

move 99 to i

repeat

	showln i " bottle(s) of beer standing on the wall"
	showln "Take one down, pass it around"
	showln ""

  	move (i-1) to i


until i EQ 0
		
showln i " bottle(s) of beer standing on the wall
showln "Gotta go to the store and buy some more"
	
abort
 
  Programming language: DBase+
 
private s
for i = 1 to 99
 s = 100 - i
   ? ltrim(str(s)) + " Bottle" + iif(s > 1,"s","") + " of beer on the wall " + ;
    ltrim(str(s)) + " bottle" + iif(s> 1,"s","") + " of beer"
   ? "   Take one down and pass it around"
   ? iif(s - 1 = 0,"No more",ltrim(str(s - 1))) + " Bottle" + iif(s = 2,"","s") + ;
    " of beer on the wall"
endfor
? "No more bottles of beer on the wall, No more bottles of beer"
? "Go to the store and buy some more - 99 bottles of beer on the wall"
 
  Programming language: DBase 2000
 
//
// Generated on 10/11/2002
//
parameter bModal
local f
f = new _9Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class _9Form of FORM
   with (this)
      onClose = {;form.Release()}
      height = 22.1818
      left = -0.1429
      top = -0.0455
      width = 109.8571
      text = "99 Bottles of Beer"
   endwith

   this.EDITOR1 = new EDITOR(this)
   with (this.EDITOR1)
      height = 20
      left = 2
      top = 0.5
      width = 107
      value = ""
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.5
      left = 1
      top = 20.5
      width = 107
      text = "Start"
      borderStyle = 7	// Client
   endwith

function PUSHBUTTON1_onClick
form.Editor1.Value = ""
form.suffix = "s "
for i = 99 to 1 step -1
   if i = 1
      form.suffix = "  "
   endif
   form.num = transform(i,"999") + " "
   form.num2 = transform(i - 1,"999") + " "
   form.Editor1.Value = form.Editor1.Value + form.num + "bottle" +;
      form.suffix + "of beer on the wall, " +;
      form.num + "bottle" + form.suffix +;
      "of beer. Take one down and pass it around, "+;
      iif(i > 1,form.num2 + "bottle" + iif(i > 2,form.suffix," "),"No more bottles ") + ;
      "of beer on the wall." +;
      chr(13)
next
form.Editor1.Value = form.Editor1.Value + " No more bottles of beer on the wall, " + chr(13) + ;
   " no more bottles of beer. " + chr(13) +;
   " Go to the store and get some more." + chr(13) +;
   " 99 bottles of beer on the wall"
return
endclass
 
  Programming language: DBASE III
 
&& BEER.PRG  - 99 Bottles of Beer  - Brian Hobbs  Jan 1996
&& (BHOBBS@cayman.vf.mmc.com)
SET TALK OFF
I=99
DO WHILE I>=1
   b = STR(i,2)
   ? b +" Bottle"
   IF i > 1
      ?? "s"
   ENDIF
   ?? " of beer on the wall "+b+" bottle"
   IF i> 1 
     ?? "s"
     ENDIF
   ?? " of beer"
   ? "   Take one down and pass it around"
   i=i-1
   b = STR(i,2)
   if i = 0
     b = "No more"
     ENDIF
   ? b + " Bottle"
   IF I > 1 .OR. I=0
      ?? "s"
   ENDIF
   ?? " of beer on the wall"
   ?
ENDDO
   ? "No more bottles of beer on the wall, No more bottles of beer"
   ? "Go to the store and buy some more - 99 bottles of beer on the wall"
SET TALK ON
 
  Programming language: dc
 
dc is the Desk Calculator for *nix; It works on reverse polish 
notation, and a few other commands. The output of this routine 
is a little jagged, as dc has no commands to control screen formatting.

 Usage: dc 99bottles                                

 where this source file is saved as 99bottles       
 NB: A blank line is required at the end of the file
     Without it, dc will not quit.
<PRE>
[   bottles of beer on the wall
]sa
[   bottles of beer
]sb
[   take one down, pass it around
]sc
[   
]sd
99sn
[lalnpsnPlblnp1-snPlcPlalnpsnPldPln0<x]sx
lxx
q

 
  Programming language: DCL (for OpenVMS)
 
$! 99 bottles of beer
$! Written for VMS DCL by rsteenw@xs4all.nl
$!
$! $fao is a system lexical function, where FAO stands for 
$! Formatted ASCII Output. There's a fair bunch of these 
$! functions accessible via DCL (the command interpreter), 
$! like querying system, device, process and user parameters, 
$! string and list manipulation, file system foo, and more.
$!
$ cnt = 99
$ msg = f$fao("!UB bottle!1%C!%Es!%F of beer", cnt)
$ loop:
$ write sys$output f$fao("!AS on the wall!/!-!AS", msg)
$ write sys$output "Take one down and pass it around"
$ cnt = cnt - 1
$ if cnt .gt. 0
$ then
$   msg = f$fao("!UB bottle!1%C!%Es!%F of beer", cnt)
$   write sys$output f$fao("!AS on the wall!/", msg)
$   goto loop
$ else
$   write sys$output "No more bottles of beer on the wall"
$ endif

 
  Programming language: DCL (on VAX)
 
$ I=100
$ FIRSTLOOP:
$ IF (I.EQ. 1) THEN GOTO LAST_BOTTLE
$ WRITE SYS$OUTPUT I," BOTTLES OF BEER ON THE WALL"
$ WRITE SYS$OUTPUT I," BOTTLES OF BEER"
$ WRITE SYS$OUTPUT "IF ONE OF THEM SHOULD HAPPEN TO FALL"
$ WRITE SYS$OUTPUT I-1," BOTTLE OF BEER ON THE WALL"
$ WRITE SYS$OUTPUT "  "
$ I=I-1
$ GOTO FIRSTLOOP
$ LAST_BOTTLE:
$ WRITE SYS$OUTPUT "1 BOTTLE OF BEER ON THE WALL"
$ WRITE SYS$OUTPUT "1 BOTTLE OF BEER"
$ WRITE SYS$OUTPUT "IF IT SHOULD HAPPEN TO FALL"
$ WRITE SYS$OUTPUT "NO MORE BOTTLES OF BEER ON THE WALL"
 
  Programming language: DCL (on VMS)
 
; VMS DCL version of 99 Bottles of Beer
$ I=100
$ FIRSTLOOP:
$ C=0
$ L=1
$ PAUSE:
$ C=C+1
$ IF (I.EQ. 1) THEN GOTO LAST_BOTTLE
$ IF (C .EQ. 1500) THEN GOTO FIRSTCLEAN
$ GOTO PAUSE
$ FIRSTCLEAN:
$ GOTO WIPESCN
$ FIRSTLINE:
$ WRITE SYS$OUTPUT I," bottles of beer on the wall,"
$ C=0
$ L=2
$ FIRSTPAUSE:
$ C=C+1
$ IF (C .EQ. 2000) THEN GOTO SECONDCLEAN
$ GOTO FIRSTPAUSE
$ SECONDCLEAN:
$ GOTO WIPESCN
$ SECONDLINE:
$ WRITE SYS$OUTPUT I," bottles of beer."
$ C=0
$ L=3
$ SECONDPAUSE:
$ C=C+1
$ IF (C .EQ. 1500) THEN GOTO THIRDCLEAN
$ GOTO SECONDPAUSE
$ THIRDCLEAN:
$ GOTO WIPESCN
$ THIRDLINE:
$ WRITE SYS$OUTPUT "If one of them should happen to fall...."
$ C=0
$ L=4
$ THIRDPAUSE:
$ C=C+1
$ IF (C .EQ. 1500) THEN GOTO FOURTHCLEAN
$ GOTO THIRDPAUSE
$ FOURTHCLEAN:
$ GOTO WIPESCN
$ FOURTHLINE:
$ WRITE SYS$OUTPUT I-1," bottles of beer on the wall."
$ I=I-1
$ GOTO FIRSTLOOP
$ LAST_BOTTLE:
$ C=0
$ L=5
$ FOURTHPAUSE:
$ C=C+1
$ IF (C .EQ. 1500) THEN GOTO FITHCLEAN
$ GOTO FOURTHPAUSE
$ FITHCLEAN:
$ GOTO WIPESCN
$ FITHLINE:
$ WRITE SYS$OUTPUT "1 bottle of beer on the wall,"
$ C=0
$ L=6
$ FITHPAUSE:
$ C=C+1
$ IF (C .EQ. 1200) THEN GOTO SIXTHCLEAN
$ GOTO FITHPAUSE
$ SIXTHCLEAN:
$ GOTO WIPESCN
$ SIXTHLINE:
$ WRITE SYS$OUTPUT "1 bottle of beer..."
$ C=0
$ L=7
$ SIXTHPAUSE:
$ C=C+1
$ IF (C .EQ. 2200) THEN GOTO SEVENTHCLEAN
$ GOTO SIXTHPAUSE
$ SEVENTHCLEAN:
$ GOTO WIPESCN
$ SEVENTHLINE:
$ WRITE SYS$OUTPUT "If it should happen to fall...."
$ C=0
$ L=8
$ LASTPAUSE:
$ C=C+1
$ IF (C .EQ. 2000) THEN GOTO LASTCLEAN
$ GOTO LASTPAUSE
$ LASTCLEAN:
$ GOTO WIPESCN
$ LASTLINE:
$ WRITE SYS$OUTPUT "No more bottles of beer on the wall."
$ GOTO QUIT
$ WIPESCN:
$ C=0
$ WIPE:
$ C=C+1
$ WRITE SYS$OUTPUT " "
$ IF (C .EQ. 25) THEN GOTO SONGLINE
$ GOTO WIPE
$ SONGLINE:
$ IF (L .EQ. 1) THEN GOTO FIRSTLINE
$ IF (L .EQ. 2) THEN GOTO SECONDLINE
$ IF (L .EQ. 3) THEN GOTO THIRDLINE
$ IF (L .EQ. 4) THEN GOTO FOURTHLINE
$ IF (L .EQ. 5) THEN GOTO FITHLINE
$ IF (L .EQ. 6) THEN GOTO SIXTHLINE
$ IF (L .EQ. 7) THEN GOTO SEVENTHLINE
$ IF (L .EQ. 8) THEN GOTO LASTLINE
$ QUIT:
 
  Programming language: DECTPU
 
DEC's Pascal-like "Text Processing Utility."

PROCEDURE BEER
          LOCAL BOTTLES, LINE_1, LINE_2, LINE_3;

          BOTTLES := 99;
          LINE_1 := "!SL bottle!%S of beer on the wall";
          LINE_2 := "!SL bottle!%S of beer,";
          LINE_3 := "If !0<!SL!>!1%Cthat single bottle"
                  + "!%Eone of those bottles!%F should happen to fall,";
          LOOP;
               COPY_TEXT( FAO( LINE_1, BOTTLES) + ","); SPLIT_LINE;
               COPY_TEXT( FAO( LINE_2, BOTTLES));       SPLIT_LINE;
               COPY_TEXT( FAO( LINE_3, BOTTLES));       SPLIT_LINE;
               BOTTLES := BOTTLES - 1;
               COPY_TEXT( FAO( LINE_1, BOTTLES) + "."); SPLIT_LINE;
SPLIT_LINE;
               EXITIF BOTTLES = 0;
          ENDLOOP;
ENDPROCEDURE
 
  Programming language: Definer (Object orientated)
 
\{
	 Program: :99 Bottles (OO Version)
	Platform: :Definer (Console)
	  Author: :Chris Sauls
	    Date: :06.03.2003
\}

include std console *;
include std wrap list array *;

define class bottle {
	define public routine Take {
		Console:WriteLine ("Take one down, pass it around.\n");
	}
}

define class shelf {
	define private bottle array {
		Bottles = 99 ** (new bottle ());
	}

	define public routine TakeOne {
		Bottles:Extract(0):Take;
	}

	define public routine Report {
		Console:WriteLine (Bottles.Length, " bottles of beer");
	}

	define public condition boolean Empty {
		return Bottles.Length == 0;
	}
}

define shelf {
	Shelf = new shelf ();
}

\{ Main Routine \}
{
	until Shelf.Empty {
		Console:WriteLine (Shelf:Report, " on the wall.\n");
		Console:WriteLine (Shelf:Report, ".\n");
		Shelf:TakeOne;
		Console:WriteLine (Shelf:Report, " on the wall.\n");
	}
	Console:WriteLine ("No more bottles of beer on the wall.\n");
}
 
  Programming language: Definer
 
\{
	 Program: :99 Bottles
	Platform: :Definer (Console)
	  Author: :Chris Sauls
	    Date: :06.03.2003
\}

include std console;

define unsigned byte {
	BottleCount	= 99;
}

define string {
	SBottles	= " bottles of beer";
	SWall		= " on the wall";
	SPeriod		= ".\n";
}

\{ Main Routine \}
{
	while BottleCount {
		Console:WriteLine (BottleCount, SBottles + SWall + SPeriod);
		Console:WriteLine (BottleCount, SBottles + SPeriod);
		Console:WriteLine ("Take one down, pass it around.\n");
		Console:WriteLine (
			--BottleCount
			? BottleCount
			| "No more"
			, SBottles, SWall, SPeriod
		);
	}
}
 
  Programming language: Delphi NonVCL
 
// *short* Delphi version of 99 Bottles of beer (Bottles.dpr)
// Philipp Winterberg, http://www.winterbergs.de
program Bottles;
uses windows, sysutils;
var b: integer;
begin
  for b:= 99 downto 1 do
   if MessageBox(0, Pchar(IntToStr(b) + ' bottle(s) of beer on the wall, ' + #13#10 +
                          IntToStr(b) + ' bottle(s) of beer.' + #13#10#13#10 +
                          'Take one down, pass it around,' + #13#10 +
                          IntToStr(b-1) + ' bottle(s) of beer on the wall.' + #13#10),
                    PChar('99 Bottles of Beer'), 65) = 2
     then exit
end.

 
  Programming language: Delphi
 
program BeerSong;
{$APPTYPE CONSOLE}
uses
  SysUtils;
var
  b :integer;
begin
   WriteLn( Format('%d bottles of beer on the wall', [99]));
   WriteLn( Format('%d bottles of beer', [99]));
   WriteLn( 'You take one down and pass it around');
   for b := 98 downto 2 do
      begin
      WriteLn( Format('%d bottles of beer on the wall.', [b]));
      WriteLn('');
      WriteLn( Format('%d bottles of beer on the wall', [b]));
      WriteLn( Format('%d bottles of beer', [b]));
      WriteLn( 'You take one down and pass it around');
      end;
   b := 1;
   WriteLn( Format('%d bottle of beer on the wall', [b]));
   WriteLn('');
   WriteLn( Format('%d bottle of beer', [b]));
   WriteLn( 'You take one down and pass it around');
   WriteLn( 'No bottles of beer on the wall!');
end
 
  Programming language: Dialect
 
# Dialect version of 99 Bottles of beer (Bottles.d) 
# See http://www.aristar.com/Downloads2.html
# Philipp Winterberg, http://www.winterbergs.de            

Import "outputs"
Output = outputs.screen()
Output.startDoc("99 Bottles of Beer")
for b = 1 to 99
  print (100-b), " bottle(s) of beer on the wall,", cr
  print (100-b), " bottle(s) of beer.", cr
  print "Take one down, pass it around,", cr
  print (99-b), " bottle(s) of beer on the wall.", cr, cr
endfor
Output.EndDoc()
 
  Programming language: Dialog
 
'Dialog System', a system for developing graphical applications.

# Programmer: Mark Gray - mvg@mfltd.co.uk
# http://www.mfltd.co.uk/
#
# Note: requires version 2.5 of Dialog System.

Form BEER
   Screenset Details
       First-Window WIN1
   End Details

   Form Data
       Group BOTTLE-TEXT-GROUP-1 Vertical Occurs 1
           NUMBER-OF-BOTTLES-1 Integer(2)
           BOTTLE-TEXT-1 Character(28)
           BOTTLE-PUNCTUATION-1 Character(1)
       End Group # BOTTLE-TEXT-GROUP-1

       Group BOTTLE-TEXT-GROUP-2 Vertical Occurs 1
           NUMBER-OF-BOTTLES-2 Integer(2)
           BOTTLE-TEXT-2 Character(17)
       End Group # BOTTLE-TEXT-GROUP-2

           BOTTLE-TEXT-1A Character(31)
           BOTTLE-TEXT-2A Character(19)
           BOTTLE-TEXT-3 Character(30)
           BOTTLE-TEXT-4 Character(34)
   End Data

   Object WIN1
       Type DIALOG-BOX
       Parent DESKTOP
       Start (492,720)
       Size  (1208,1150)
       Display "99 Bottles of Beer"
       Style MODELESS TITLEBAR SYSTEM-MENU
   End Object  #WIN1

   Object BEER-LIST
       Type LIST-BOX
       Parent WIN1
       Start (64,100)
       Size  (1088,800)
       Style DISABLE-HORIZONTAL
   End Object  #BEER-LIST

   Object PB1
       Type PUSH-BUTTON
       Parent WIN1
       Start (416,1040)
       Size  (372,96)
       Display "Close"
   End Object  #PB1

   Global Dialog CASE(OFF)
       Event ESC
           SET-EXIT-FLAG ;
           TERMINATE ;
       End Event # ESC
       Event CLOSED-WINDOW
           SET-EXIT-FLAG ;
           TERMINATE ;
       End Event # CLOSED-WINDOW
       Event BUTTON-SELECTED
           SET-EXIT-FLAG ;
           TERMINATE ;
       End Event # BUTTON-SELECTED
       Event SCREENSET-INITIALIZED
           MOVE " bottles of beer on the wall" BOTTLE-TEXT-1(1) ;
           MOVE " bottles of beer," BOTTLE-TEXT-2(1) ;
           MOVE "Take one down, pass it around," BOTTLE-TEXT-3 ;
           MOVE "Go to the store and buy some more," BOTTLE-TEXT-4 ;
           MOVE 99 NUMBER-OF-BOTTLES-1(1) ;
           BRANCH-TO-PROCEDURE COUNT-BOTTLES ;
       End Event # SCREENSET-INITIALIZED
       Procedure COUNT-BOTTLES
           MOVE NUMBER-OF-BOTTLES-1(1) NUMBER-OF-BOTTLES-2(1) ;
           MOVE "," BOTTLE-PUNCTUATION-1(1) ;
           MOVE BOTTLE-TEXT-GROUP-1 BOTTLE-TEXT-1A ;
           MOVE BOTTLE-TEXT-GROUP-2 BOTTLE-TEXT-2A ;
           INSERT-LIST-ITEM BEER-LIST BOTTLE-TEXT-1A 0 ;
           INSERT-LIST-ITEM BEER-LIST BOTTLE-TEXT-2A 0 ;
           MOVE "." BOTTLE-PUNCTUATION-1(1) ;
           IF= NUMBER-OF-BOTTLES-1(1) 0 END-BOTTLES ;
           INSERT-LIST-ITEM BEER-LIST BOTTLE-TEXT-3 0 ;
           DECREMENT NUMBER-OF-BOTTLES-1(1) ;
           MOVE BOTTLE-TEXT-GROUP-1 BOTTLE-TEXT-1A ;
           INSERT-LIST-ITEM BEER-LIST BOTTLE-TEXT-1A 0 ;
           BRANCH-TO-PROCEDURE COUNT-BOTTLES ;
       End Procedure # COUNT-BOTTLES
       Procedure END-BOTTLES
           MOVE 99 NUMBER-OF-BOTTLES-1(1) ;
           MOVE BOTTLE-TEXT-GROUP-1 BOTTLE-TEXT-1A ;
           INSERT-LIST-ITEM BEER-LIST BOTTLE-TEXT-4 0 ;
           INSERT-LIST-ITEM BEER-LIST BOTTLE-TEXT-1A 0 ;
       End Procedure # END-BOTTLES
   End Dialog
End Form
 
  Programming language: DIBOL
 
.TITLE - "Program to display 99 bottles of beer on the wall"
;
;=======================================================================================================
;	Author: Bob Welton (welton@pui.com)
;		Projects Unlimited Inc.
;		Dayton, OH  45414
;
;	Language: DIBOL or DBL
;=======================================================================================================

RECORD MISC
    NUMBOTTLES	,D2,99			;Default # of bottles to 99
    ANUMBOTTLES	,A2			;Used to mask the output of bottles


.PROC
    XCALL FLAGS (0007000000,1)		;Suppress STOP message
    OPEN (8,O:C,"TT:")        		;Open the terminal/display
    REPEAT
	BEGIN
	ANUMBOTTLES = NUMBOTTLES,'ZX'
	WRITES (8,ANUMBOTTLES+" Bottles of Beer on the wall,")
	ANUMBOTTLES = NUMBOTTLES,'ZX'
	WRITES (8,ANUMBOTTLES+" Bottles of Beer,")
	WRITES (8,"   Take one down, pass it around,")
	DECR NUMBOTTLES	      		;Reduce # of bottles by 1
	IF (NUMBOTTLES .LE. 1) EXITLOOP	;If just 1 bottle left, get out
	ANUMBOTTLES = NUMBOTTLES,'ZX'
	WRITES(8,ANUMBOTTLES+" Bottles of Beer on the wall.") 
	WRITES (8," ")
	END
    ANUMBOTTLES = NUMBOTTLES,'ZX'
    WRITES(8,ANUMBOTTLES+" Bottle of Beer on the wall.") 
    WRITES (8," ")
    WRITES (8,ANUMBOTTLES+" Bottle of Beer on the wall,")
    WRITES (8,ANUMBOTTLES+" Bottle of Beer,")
    WRITES (8,"   Take one down, pass it around,")
    WRITES (8," ")
    WRITES (8," ")
    WRITES (8, "Hey the Beer's gone, I am out of here...")
    SLEEP 2
    CLOSE 8
    STOP
.END
 
  Programming language: DiNGS Game Basic
 
// DiNGS Game Basic version of 99 Bottles of beer (Bottles.src)
// See http://www.dream-d-sign.de/DINGS/Infos/infos.html
// Philipp Winterberg, http://www.winterbergs.de

LIMITFPS 23; BLACKSCREEN
FOR b=99 TO 1 STEP -1 
  PRINT b, 23, 23; PRINT "   bottle(s) of beer on the wall,", 23, 23  
  PRINT b, 23, 63; PRINT "   bottle(s) of beer.", 23, 63
  PRINT "Take one down, pass it around,", 23, 103
  PRINT b-1, 23, 143;  PRINT "   bottle(s) of beer on the wall.", 23, 143
  SHOWSCREEN; MOUSEWAIT
NEXT; END
 
  Programming language: Doc1 PCE
 
**********************************************************************
*  
*  99 Bottles of Beer on the wall
*
*  Uses Group 1 Software PCE (Post Composition Engine) Language
*  www.g1.com
*
*  By: Donavan Hoepcke www.computerdudes.nu
*
**********************************************************************
declare <done>;
declare <num-bottles>;
declare <num-bottle-str>;
declare <zero>;
declare <one>;

  // Procedures
declare procedure <main> is main;
**********************************************************************
begin procedure <main>;

  let <zero> = 0;
  let <one> = 1;
  let <done> = false;
  let <num-bottles> = 99;

  let <num-bottle-str> = string <num-bottles> 0 zero;

  begin loop;

    trace "@@<num-bottle-str> bottles of beer on the wall";
    trace "@@<num-bottle-str> bottles of beer";
    trace "Take one down, pass it around";

    let <num-bottles> = <num-bottles> - <one>;
    let <num-bottle-str> = string <num-bottles> 0 zero;

    let <done> = <num-bottles> eq <one>;
      exit loop when <done>;

    trace "@@<num-bottle-str> bottles of beer on the wall";
   
  end loop;

  trace "@@<num-bottle-str> bottle of beer on the wall";
  trace "@@<num-bottle-str> bottle of beer";
  trace "Take one down, pass it around";
  trace "Time to buy some more beer for the wall";

end procedure; // <main>
 
  Programming language: DOS Batch
 
@echo off
REM 99 Bottles of Beer in DOS Batch
REM Gert-jan Los (los@lsdb.bwl.uni-mannheim.de)
REM The file with batch program must be named as "beer.bat"
REM Noted by Vladimir Vojacek (vojacek@seznam.cz), 2003-07-03

if "%1"=="" goto outer
if "%1"=="body" goto body
:inner
for %%a in ( 9 8 7 6 5 4 3 2 1 0 ) do call beer body %2 %%a
goto exit

:outer
for %%a in ( 9 8 7 6 5 4 3 2 1 0 ) do call beer inner %%a
goto exit

:body
set num=%2%3
set bottle=bottles
if "%num%"=="99" goto skipfirst
if "%2"=="0" set num=%3
if "%num%"=="1" set bottle=bottle
echo %num% %bottle% of beer on the wall
echo.
if "%num%"=="0" exit
:skipfirst
echo %num% %bottle% of beer on the wall
echo %num% %bottle% of beer
echo take one down and pass it around
:exit
 
  Programming language: Dot Tool
 
Dot-Tool is a self-written development-tool from Christopher
Winter, employee of Siemens VDO Automotive AG, and is used 
within the software development and simulation of the multi-
function-displays of Siemens VDO.



@99Bottles
 // 99 bottles of beer with DOT-Tool Macro
 // DOT-Tool - dot-display-simulation
 // (c) Christopher Winter
 
 // set display dimensions
 MODE("FREI", 193, 36);
 // show dot
 PAGE(3);
 // switch on dot-grid
 GRID(1);
 ANIMATE(0);
 // drink!
 FOR (i=99; i > 0; i--) {
  CLS();
  TEXT(1, 1,2,itoa(i)+" BOTTLES OF BEER ON THE WALL,");
  TEXT(1,10,2,itoa(i)+" BOTTLES OF BEER");
  TEXT(1,19,2,"TAKE ONE DOWN AND PASS IT AROUND");
  TEXT(1,28,2,itoa(i-1)+" BOTTLES OF BEER ON THE WALL");
  UPDATE();
  ANIMATE(2);
  PAUSE(100);
  ANIMATE(1);
 }
 ANIMATE(3, "99BOTTLES.GIF");
 
  Programming language: DPas
 
{ DPas version of 99 Bottles of beer (Bottles.pas)               }
{ See (http://www.geocities.com/SiliconValley/Bay/9159/dpas.html }
{ Philipp Winterberg, http://www.winterbergs.de                  }

program Bottles;
uses crt32;
var b: byte = 99;
begin
  while b > 0 do
    begin
      writeln(b, ' bottle(s) of beer on the wall, ');
      writeln(b, ' bottle(s) of beer.');
      writeln('Take one down, pass it around,'); dec(b);
      writeln(b, ' bottle(s) of beer on the wall.');
      writeln(' ');
    end;
end.
 
  Programming language: Draco
 
An Amiga language combining features of  <a href=#c>C</a> and <a href=#pascal>Pascal</a>

/* 99 Bottles of Beer */
/* James Hicks (hicksjl@cs.rose-hulman.edu) */
/* 5 August 1996 */

int BEERS = 99;

proc main()void:

  uint i;

  for i from BEERS downto 1 do
    if i > 1 then
      writeln(i, " bottles of beer on the wall, ", i, " bottles of beer.");
    else
      writeln(i, " bottle of beer on the wall, ", i, " bottle of beer.");
    fi;
    writeln("Take one down, pass it around,");
    if i > 2 then
      writeln(i - 1, " bottles of beer on the wall.");
    elsif i > 1 then
      writeln(i - 1, " bottle of beer on the wall.");
    else
      writeln("No bottles of beer on the wall.");
    fi;
  od;

corp;
 
  Programming language: DSSP
 
For Info see <a href=http://www.dssp.msk.ru>http://www.dssp.msk.ru</a>

[  99 bottles in DSSP
   Programmer: Laszlo Aszalos <aszalos@math.klte.hu>

   Run it with 99 BOTTLE
]

B10
: BOTTLE [N] LOT_OF ONE_LEFT ZERO [] ;
: LOT_OF [N] CR C 1- DO ONE_BOTTLE D ;
: ONE_BOTTLE [N]
     ON_THE_WALL .", " CR NUMBER_OFF BOTTLES ."," CR
     TAKE 1- [N-1] C 1 = IF0 MANY ;
: MANY ON_THE_WALL ."." CR ;
: TAKE ."take one down, pass it around," CR ;
: ON_THE_WALL NUMBER_OFF BOTTLES ." on the wall" ;
: BOTTLES ." bottles of beer" ;

: ONE_LEFT ONE_ON_THE_WALL ."." CR ONE_ON_THE_WALL ."," CR BOTTLE1 
."," CR ; 
: ONE_ON_THE_WALL BOTTLE1 ." on the wall" ;
: BOTTLE1 ." 1 bottle of beer" ;

: ZERO TAKE ZERO_ON ."." CR ZERO_ON ."," CR  NO_MORE ."," CR
       ."go to the store, and buy some more!" CR ;
: ZERO_ON  NO_MORE ." on the wall" ;
: NO_MORE ."no more bottles of beer" ;
: NUMBER_OFF C 2 TON ;
: NUMBER_OFF C 2 TON ;
 
  Programming language: DTML
 
DTML (Document Template Markus Language) is the scripting language
of the web management tool 'Zope'.


<dtml-call "REQUEST.set('i',_.range(0,100,1))">
<dtml-call "REQUEST.set('r',99)">

<dtml-in i reverse>

<dtml-if expr="r==1">
   <dtml-var sequence-item> bottle of beer on the wall, <dtml-var
sequence-item> bottle of beer
   take one down, pass it around,
   <dtml-var sequence-item> bottle of beer.
<dtml-elif expr="r==0">
   no more bottles of beer on the wall.
   Go to the store, buy some more.
<dtml-else>
   <dtml-var sequence-item> bottles of beer on the wall, <dtml-var
sequence-item> bottles of beer
   take one down, pass it around,
   <dtml-var sequence-item> bottles of beer.
</dtml-if>

<dtml-call "REQUEST.set('r',r-1)">

</dtml-in>

 
  Programming language: DYL 280
 
Here's one more example to add to the list.  It is in a language called
'DYL-280' (pronounced 'dial 280').

FILE INFILE INPUT FB
WORKAREA
 NUMOFBOTTLES  3  NU
REPORT 80 WIDE
NUMOFBOTTLES = 99
LOOP:
IF NUMOFBOTTLES EQ 0
   LIST 'NO MORE BEER ON THE WALL.'
   STOP
ENDIF
LIST NUMOFBOTTLES () 'BOTTLES OF BEER ON THE WALL,' AT NUMOFBOTTLES+4
LIST NUMOFBOTTLES () 'BOTTLES OF BEER.' AT NUMOFBOTTLES+4
LIST 'TAKE ONE DOWN PASS IT AROUND' AT NUMOFBOTTLES+4
NUMOFBOTTLES = NUMOFBOTTLES - 1
LIST NUMOFBOTTLES () 'BOTTLES OF BEER ON THE WALL.' AT NUMOFBOTTLES+4
LIST '   '
GOTO LOOP
FIN
/*
 
  Programming language: Dylan
 
// Dylan version of 99 Bottles of Beer
// programmer: Jim Studt jim@federated.com

define method enumerate( count == 1 ) "1 bottle" end method enumerate;
define method enumerate( count == 0 ) "no more bottles" end method enumerate;
define method enumerate( count :: <integer> )
  format-to-string("%d bottles", count);
end method enumerate;

define method reference( count == 1) "it" end method reference;
define method reference( count :: <integer>) "one" end method reference;

define method main (argv0, #rest noise)
  for ( i from 99 to 1 by -1) 
    format( *standard-output*, "%s of beer on the wall, %s of beer.\n", 
	   enumerate(i), enumerate(i));
    format( *standard-output*, 
	   "  Take %s down, pass it around, %s of beer on the wall.\n",
	   reference(i), enumerate( i - 1));
  end for;
end method main;
 
  © Oliver Schade <os@ls-la.net>, Generated: 06.06.2003 17:38:32