Here is a version of of the program in L.S.E. (Langage Symbolique
d'Enseignement), a French programming language used in the 1970's on
mini-computers (and later on early micro-computers) in high-schools
(Lycées) in France.
1*CHANSON DES 99 BOUTEILLES DE BIERE
2*PASCAL BOURGUIGNON, <PJB@INFORMATIMAGO.COM>, 2003
10 FAIRE 20 POUR N_99 PAS -1 JUSQUA 1
20 &STROF(N)
30 AFFICHER['IL EST TEMPS D''ALLER AU MAGASIN.',/]
40 TERMINER
100 PROCEDURE &STROF(N) LOCAL S1,S0;CHAINE S1,S0;S1_"S";S0_"S"
110 SI N=2 ALORS S0_"S" SINON SI N=1 ALORS DEBUT S1_"";S2_"" FIN
120 AFFICHER[U,' BOUTEILLE',U,' DE BIERE SUR LE MUR.',/]N,S1
130 AFFICHER[U,' BOUTEILLE',U,' DE BIERE.',/]N,S1
140 AFFICHER['EN PRENDRE UNE, LA FAIRE PASSER.',/]
150 AFFICHER[U,' BOUTEILLE',U,' DE BIERE SUR LE MUR.',2/]N-1,S0
160 RETOUR
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
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
# 99 Bottles of Beer on the Wall...
# by 3pixelBob
integer num_beers
num_beers = 99
while num_beers > 0
echo( inttostr( num_beers ) + " bottles of beer on the wall," )
echo( inttostr( num_beers ) + " bottles of beer," )
echo( "Take one down and pass it around," )
num_beers = num_beers - 1
echo( inttostr( num_beers ) + " bottles of beer on the wall." )
end while
if num_beers = 0
echo( "No more beer!", _color_red )
end if
See http://www.blueworld.com/ for more informations
[lasso_comment]
Implementation of 99 Bottles of Beer in Lasso 3.6.6.
Chris Latko
http://www.latko.org/
October 19, 2002
[/lasso_comment]
<html>
<head>
<title>99 Bottles of Beer</title>
</head>
<body>
[var_set:'bottleNo'='Bottles']
[loop:loopfrom=99,loopto=2,loopincrement=-1]
[if:(loopcount)==1]
[var_set:'bottleNo'='Bottle']
[/if]
[loopcount] [var:'bottleNo'] of Beer on the wall, [loopcount]
[var:'bottleNo'] of Beer,<br>
[if:(math_sub:(loopcount),'1')==1]
[var_set:'bottleNo'='Bottle']
[/if]
Take one down, pass it around, [math_sub:(loopcount),'1']
[var:'bottleNo'] of Beer on the wall
[/loop]
1 Bottle of Beer on the wall, 1 Bottle of Beer,
<br>Take one down, pass it around, no Bottles of Beer on the wall
</body>
</html>
\Thomas\bye
% LaTeX2e-Version
% (th-beer@square.de), 2002-01-11
\documentclass{article}
\usepackage{ifthen}
\parindent 0 pt
\parskip 1.5 ex
\newcounter{beers}\setcounter{beers}{99}
\begin{document}
\whiledo{\value{beers}>1}{%
\thebeers\ Bottles of beer on the wall, \thebeers\ bottles of beer\\
Take one down and pass it around,\\
\addtocounter{beers}{-1}\thebeers\ %
\ifthenelse{\equal{\thebeers}{1}}{bottle}{bootles}
of beer on the wall.\par
}
\whiledo{\value{beers}>0}{%
\thebeers\ Bottle of beer on the wall, \thebeers\ bottle of beer\\
Take one down and pass it around,\\
\addtocounter{beers}{-1}no bootles of beer on the wall.\par
}
\end{document}
Leda is a multiparadigm programming language designed by Timothy
A. Budd. It supports imperative, object-oriented, functional and
logic programming paradigms.
<a href=http://www.cs.orst.edu/~budd/vita/ledatoc.htm>Click here</a>
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;
' Liberty Basic version of 99 Bottles of beer (Bottles.bas)
' See http://world.std.com/~carlg/
' Philipp Winterberg, http://www.winterbergs.de
for b = 99 to 1 step -1
print b; " bottle(s) of beer on the wall,"
print b; " bottle(s) of beer."
print "Take one down, pass it around, "
print (b-1); " bottle(s) of beer on the wall." + chr$(13) + chr$(10)
next b
<A HREF=http://www.isg.sfu.ca/life/>LIFE</A> 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).
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");
}
}
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
;;; Lisp example of "99 Bottles of beer on the wall"
;;;
;;; NOTE: Although my mailer insists on inserting
;;; (at least) one, there is no line break in the
;;; string beginning "~~ (i.e. it should all be on one line).
;;;
;;; In particular, if it breaks so that the first line
;;; ends with "...~~R" and the second line starts "~0@..."
;;; they should be put back together with a space between
;;; them. That is, it should read "...~~R ~0@...".
;;; Or just see it here:
;;; http://www.sover.net/~nichael/lisp99.html
(labels ((foo (x)
(and (<= 0 x) (cons x (foo (1- x))))))
(format t (format nil
"~~{~~&~~@(~~%~~R ~A ~A!~~)~~:*~~&~~@(~~R ~0@*~A!~~)~~&~~@(~2@*~A!~~)~~&~~@(~~[~A~~:;~~:*~~R~~:*~~] ~0@*~A!~~)~~}"
"bottles of beer"
"on the wall"
"take one down, pass it around"
"no more"
)
(foo 99)))
<a href=http://www.inasec.ca/com/Logo/mainpb.htm>Logo</a> is a
simple language, suitable for teaching and famed for its
"turtle" graphics. <a href=http://http.cs.berkeley.edu/~bh/>More info</a>
; 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
Sub Click(Source As Button)
' -----------------------------------------------------
' 99 Bottle of Beer on the Wall, in LotusScript
' By Sean Heffernan
' -----------------------------------------------------
Dim ui As New NotesUIWorkspace
Dim s As String
Dim n As Integer
For n = 99 To 1 Step -1
If n > 1 Then
s = Cstr(n) + " bottles of beer on the wall. " +
Cstr(n) + " bottles of beer. Take one down, pass it around. " + Cstr(n-1)
+ " bottles of beer on the wall."
Else
s = "Only one more bottle of beer on the wall.
Only one more bottle of beer. Take it down, pass it around. No more
bottles of beer on the wall."
End If
Call ui.Prompt ( PROMPT_OK, "99 Bottles of Beer ...", s )
Next
End Sub
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");
}
}
-- Lua 99 Bottles of Beer
-- by Philippe Lhoste <PhiLho@GMX.net> http://jove.prohosting.com/~philho/
function PrintBottleNumber(n)
local bs
if n == 0 then
bs = "No more bottles"
elseif n == 1 then
bs = "One bottle"
else
bs = n .. " bottles"
end
return bs .. " of beer"
end
for bn = 99, 1, -1 do
write(PrintBottleNumber(bn), " on the wall, \n")
write(PrintBottleNumber(bn), "\n")
write("Take one down and pass it around,\n")
write(PrintBottleNumber(bn-1), " on the wall, \n\n")
end
write("No more bottles of beer on the wall,\nNo more bottles of beer\n")
write("Go to the store, buy some more!\n")
<A HREF=http://www.isg.sfu.ca/life/>Luck</A> 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