99 bottles of beer: Difference between revisions

PascalABC.NET
m (Automated syntax highlighting fixup (second round - minor fixes))
(PascalABC.NET)
 
(81 intermediate revisions by 31 users not shown)
Line 57:
 
=={{header|6800 Assembly}}==
See [[99 Bottles of Beer/Assembly]]
 
=={{header|68000 Assembly}}==
See [[99 Bottles of Beer/Assembly]]
 
Line 212 ⟶ 215:
cl_demo_output=>display( ).
</syntaxhighlight>
 
=={{header|ABC}}==
<syntaxhighlight lang="abc">HOW TO RETURN bottles n:
SELECT:
n<0: RETURN "99 bottles"
n=0: RETURN "No more bottles"
n=1: RETURN "1 bottle"
n>1: RETURN "`n` bottles"
 
HOW TO SING VERSE n:
WRITE "`bottles n` of beer on the wall,"/
WRITE "`bottles n` of beer,"/
SELECT:
n=0: WRITE "Go to the store and buy some more,"/
n=1: WRITE "Take it down and pass it around,"/
n>1: WRITE "Take one down and pass it around,"/
WRITE "`bottles (n-1)` of beer on the wall."/
WRITE /
 
FOR n IN {0..99}:
SING VERSE 99-n</syntaxhighlight>
 
=={{header|ACL2}}==
See [[99 Bottles of Beer/Lisp]]
 
=={{header|Acornsoft Lisp}}==
See [[99 Bottles of Beer/Lisp]]
 
Line 953 ⟶ 980:
 
-- At the prompt, type 'N beer !' (no quotes), where N is the number of stanzas you desire</syntaxhighlight>
 
=={{header|BabyCobol}}==
<syntaxhighlight lang="cobol">
* Pointing out some interesting things:
* - BY 0 subclause of VARYING (illegal in some COBOL dialects)
* - PERFORM THROUGH with internal/external GO TOs
* - using non-reserved keywords (END, DATA)
* - ALTER (works the same way in COBOL)
* - fall-through from MANY-BOTTLES
* - the last NEXT SENTENCE does nothing (plays the role of EXIT)
IDENTIFICATION DIVISION.
PROGRAM-ID. 99 BOTTLES.
DATA DIVISION.
01 DATA PICTURE IS 999.
PROCEDURE DIVISION.
LOOP VARYING DATA FROM 99 BY 0
PERFORM COUNT-BOTTLES THROUGH END
DISPLAY DATA "bottles of beer"
DISPLAY "Take one down, pass it around"
SUBTRACT 1 FROM DATA
IF DATA = 1
THEN ALTER COUNT-BOTTLES TO PROCEED TO SINGLE-BOTTLE
END
PERFORM COUNT-BOTTLES THROUGH END
DISPLAY ""
END.
NO-BOTTLES-LEFT.
DISPLAY "No bottles of beer on the wall"
DISPLAY ""
DISPLAY "Go to the store and buy some more"
DISPLAY "99 bottles of beer on the wall".
STOP.
COUNT-BOTTLES.
GO TO MANY-BOTTLES.
SINGLE-BOTTLE.
DISPLAY DATA "bottle of beer on the wall".
GO TO NO-BOTTLES-LEFT.
MANY-BOTTLES.
DISPLAY DATA "bottles of beer on the wall".
END.
NEXT SENTENCE.
</syntaxhighlight>
 
=={{header|BASIC}}==
Line 960 ⟶ 1,029:
==={{header|BaCon}}===
See [[99 Bottles of Beer/Basic#BaCon]]
 
==={{header|BASIC256}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|BBC BASIC}}===
Line 966 ⟶ 1,038:
==={{header|Commodore BASIC}}===
See [[99 Bottles of Beer/Basic#Commodore_BASIC]]
 
==={{header|Craft Basic}}===
See [[99 Bottles of Beer/Basic#Craft_Basic]]
 
==={{header|Creative Basic}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|FBSL}}===
Line 986 ⟶ 1,064:
 
==={{header|Microsoft Small Basic}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|Minimal BASIC}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|MSX Basic}}===
See [[99 Bottles of Beer/Basic]]
 
Line 995 ⟶ 1,079:
 
==={{header|PureBasic}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|QB64}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|QBasic}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|QuickBASIC}}===
See [[99 Bottles of Beer/Basic]]
 
Line 1,001 ⟶ 1,094:
 
==={{header|Run BASIC}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|Sinclair ZX81 BASIC}}===
See [[99 Bottles of Beer/Basic]]
 
Line 1,010 ⟶ 1,106:
 
==={{header|TI-89 BASIC}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|Tiny BASIC}}===
See [[99 Bottles of Beer/Basic]]
 
Line 1,019 ⟶ 1,118:
 
==={{header|Visual Basic .NET}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|XBasic}}===
See [[99 Bottles of Beer/Basic]]
 
==={{header|Yabasic}}===
See [[99 Bottles of Beer/Basic]]
 
Line 1,403 ⟶ 1,508:
p "One bottle of beer on the wall, one bottle of beer!"
p "Take one down, pass it around, no more bottles of beer on the wall."</syntaxhighlight>
 
=={{header|Bruijn}}==
<syntaxhighlight lang="bruijn">
:import std/Combinator .
:import std/Number .
:import std/String .
 
main [y [[=?0 case-end case-rec]] (+99)]
case-rec n ++ t1 ++ n ++ t2 ++ t3 ++ n ++ t1 ++ "\n" ++ (1 --0)
n number→string 0
t1 " bottles of beer on the wall\n"
t2 " bottles of beer\n"
t3 "Take one down, pass it around\n"
case-end empty
</syntaxhighlight>
 
=={{header|BQN}}==
Line 1,904 ⟶ 2,024:
WriteLine("Go to the store to buy some more, 99 bottles of beer on the wall...");
}</syntaxhighlight>
 
=={{header|C/vFP16}}==
<syntaxhighlight
lang="cpp">#pragma SCH_64_16_IFP
#import <jobsched.c>
 
__attr(@canschedule)
volatile constricts async UVOID <__INVAR const T>base_000000 __PCON(
impure VFCTX_t^ ct_base,
impure MCHR_t^ sched_arg,
__LVAR <const T>XVF_fntype_t^ f,
<out VF_QSWitch_t>XVF_fn_t^ switchctx
) __ARGFILL {
VF_Xsched_ILock(ct_base, $->sched);
 
captured __VFObj <>VF_KeDbg^ ki = VF_Xg_KeDbg_Instance();
 
captured deferred <__VF_T_Auto>__VF_Auto^ vfke = copyof VF_KeDbg_GetRstream<MCHR_t^>(captures ki);
VF_Gsched_SOBFree(sched_arg);
VF_Gsched_Alloc_U16(65535);
VF_Msched_MChr_lim(1496);
VF_Osched_Begin();
VF_Fsched_Add2(%beer_000099);
 
VF_Xsched_IUnlock(ct_base, $->sched);
$switchctx(IMPURE_CTX, %beer_000099(%vfke));
}
 
__attr(@eUsesIo)
impure constricts UVOID synchronized beer_000099(
impure __noinline <MCHR_t^>RIGHTSTREAM_t^ outrs
) __NFILL {
pure UVOID^ uvid = __attr(@purify) $UVOID.;
while ( 99 > ((volatile NUM_t)^(NUM_t^)(uvid))++ ) {
VF_STM_Out_NUM((NUM_t^)uvid);
VF_STM_Out_x(__Dynamic C"bottles on the wall.\nPut one down, pass it around\n");
}
return $__;
}
</syntaxhighlight>
 
=={{header|C++}}==
Line 3,663 ⟶ 3,826:
`)
}</syntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
func$ bottle num .
if num = 1
return "bottle"
.
return "bottles"
.
#
i = 99
repeat
print i & " " & bottle i & " of beer on the wall"
print i & " " & bottle i & " of beer"
print "Take one down, pass it around"
i -= 1
until i = 0
print i & " " & bottle i & " of beer on the wall"
print ""
.
print "No more bottles of beer on the wall"
</syntaxhighlight>
 
=={{header|ECL}}==
Line 3,689 ⟶ 3,874:
OUTPUT(SORT(Rev,-Recid1,-RecID2),{txt},ALL);
</syntaxhighlight>
 
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">module Bottles {
void run() {
function String(Int) num = i -> i==0 ? "No" : i.toString();
function String(Int) bottles = i -> i==1 ? "bottle" : "bottles";
 
@Inject Console console;
for (Int remain : 99..1) {
console.print($|{num(remain)} {bottles(remain)} of beer on the wall
|{num(remain)} {bottles(remain)} of beer
|Take one down, pass it around
|{num(remain-1)} {bottles(remain-1)} of beer on the wall
|
);
}
}
}</syntaxhighlight>
 
=={{header|Egel}}==
Line 3,816 ⟶ 4,019:
map beer [99,98..0]</syntaxhighlight>
 
=={{header|Elan}}==
<syntaxhighlight lang="elan">INT VAR number of bottles;
 
PROCEDURE print how many bottles are on the wall (INT CONST number):
print number;
print bottle;
print trailing text.
 
print number:
IF number = 0 THEN
put ("No")
ELSE
put (number)
END IF.
 
print bottle:
out ("Bottle");
IF no <> 1 THEN
out ("s")
END IF.
 
print trailing text:
out (" of beer").
END PROCEDURE print how many bottles are on the wall;
 
say hello;
print song;
say goodbye.
 
say hello:
putline ("99 Bottles of Beer");
putline ("==================");
line.
 
print song:
FOR number of bottles FROM 99 DOWNTO 1 REPEAT
print first line;
print second line;
print third line
END REPEAT.
 
say goodbye:
line;
putline ("=====================");
putline ("You need a ride home?");
line.
 
print first line:
print how many bottles are on the wall (number of bottles);
out (" on the wall, ");
print how many bottles are on the wall (number of bottles);
line.
 
print second line:
putline ("Take one down and pass it around,").
 
print third line:
print how many bottles are on the wall (number of bottles - 1);
putline (" on the wall");
line.</syntaxhighlight>
 
=={{header|Elena}}==
ELENA 56.0 :
<syntaxhighlight lang="elena">import system'routines;
import extensions;
Line 3,829 ⟶ 4,093:
= self.toPrintable() + (self != 1).iif(" bottles"," bottle");
bottleEnumerator() = new Variable(self).doWith::(n)
{
^ new Enumerator
Line 3,835 ⟶ 4,099:
bool next() = n > 0;
get Value() = new StringWriter()
.printLine(n.bottleDescription()," of beer on the wall")
.printLine(n.bottleDescription()," of beer")
.printLine("Take one down, pass it around")
.printLine((n.reduce:(1)).bottleDescription()," of beer on the wall");
reset() {}
enumerable() = __targetweak self;
}
};
Line 3,852 ⟶ 4,116:
var bottles := 99;
bottles.bottleEnumerator().forEach:(printingLn)
}</syntaxhighlight>
{{out}}
Line 3,937 ⟶ 4,201:
(message "%d bottles of beer on the wall" (1- i))
(setq i (1- i))))</syntaxhighlight>
 
=={{header|EMal}}==
This version writes the lyrics as described here: https://99-bottles-of-beer.net/lyrics.html
<syntaxhighlight lang="emal">
type NinetynineBottles
int DEFAULT_BOTTLES_COUNT = 99
model
int initialBottlesCount, bottlesCount
new by int =bottlesCount
me.initialBottlesCount = bottlesCount
end
fun subject = <|when(me.bottlesCount == 1, "bottle", "bottles")
fun bottles = <|when(me.bottlesCount == 0, "no more", text!me.bottlesCount)
fun goToWall = void by block
text line = me.bottles() + " " + me.subject() + " of beer on the wall, " +
me.bottles() + " " + me.subject() + " of beer."
if me.bottlesCount == 0 do line[0] = line[0].upper() end # text can be modified
writeLine(line)
end
fun takeOne = logic by block
if --me.bottlesCount < 0 do return false end # cannot take a beer down
writeLine("Take one down and pass it around, " + me.bottles() +
" " + me.subject() + " of beer on the wall.")
writeLine()
return true
end
fun goToStore = void by block
writeLine("Go to the store and buy some more, " + me.initialBottlesCount +
" bottles of beer on the wall.")
end
fun play = void by block
for ever
me.goToWall()
if not me.takeOne()
me.goToStore()
break
end
end
end
end
NinetynineBottles(when(Runtime.args.length > 0, int!Runtime.args[0], DEFAULT_BOTTLES_COUNT)).play()
</syntaxhighlight>
The output for two bottles of beer is as follows.
{{out}}
<pre>
2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.
 
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.
 
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 2 bottles of beer on the wall.
</pre>
 
=={{header|Erlang}}==
Line 4,109 ⟶ 4,427:
=={{header|FALSE}}==
See [[99 Bottles of Beer/EsoLang]]
 
=={{header|Fe}}==
<syntaxhighlight lang="clojure">
(= n 99)
(while (< 0 n)
(print n "bottles of beer on the wall")
(print n "bottles of beer")
(print "Take one down, pass it around")
(= n (- n 1))
(print n "bottles of beer on the wall\n"))
</syntaxhighlight>
 
=={{header|ferite}}==
Line 4,676 ⟶ 5,005:
od;
end;</syntaxhighlight>
 
=={{header|GDScript}}==
{{works with|Godot|4.0}}
 
<syntaxhighlight lang="gdscript">
extends MainLoop
 
# Represents a count of bottles
class Bottles:
var count := 99
 
func take(n: int = 1) -> void:
count -= n
 
func _to_string() -> String:
match count:
0: return "No more bottles"
1: return "1 bottle"
_: return "%s bottles" % count
 
func _process(_delta: float) -> bool:
var bottles := Bottles.new()
while bottles.count > 0:
print("%s of beer on the wall" % bottles)
print("%s of beer" % bottles)
print("Take one down, pass it around")
bottles.take()
print("%s of beer on the wall" % bottles)
# Seperate paragraphs
if bottles.count > 0:
print()
 
return true # Makes the program exit
</syntaxhighlight>
 
===Silly node-tree version===
This uses the node's children as the display method (which can be viewed in-editor with the remote tab).
 
<syntaxhighlight lang="gdscript">
extends Node
 
@export var alcoholism: int = 99
 
func _ready():
# Add the lyrics as child nodes
var padding := "" # Avoid name clashes by adding spaces
for bottleCount in range(alcoholism, 0, -1):
# Seperate paragraphs with blank nodes
if bottleCount < alcoholism:
add_lyric(padding)
add_lyric("%s of beer on the wall" % [_formatBottles(bottleCount)])
add_lyric("%s of beer" % [_formatBottles(bottleCount)])
add_lyric("Take one down, pass it around" + padding)
add_lyric("%s of beer on the wall " % [_formatBottles(bottleCount - 1)]) # Extra space for name clash avoidance
padding += " " # Add spaces so the names don't clash
 
func _formatBottles(bottleCount: int) -> String:
return "%d bottle%s" % [bottleCount, "" if bottleCount == 1 else "s"]
 
func add_lyric(lyric: String) -> void:
var new_child := Node.new()
new_child.name = lyric
add_child(new_child)
</syntaxhighlight>
 
=={{header|Genie}}==
Line 5,545 ⟶ 5,938:
if more than one thing is on the wall, say list of things on the wall;
otherwise say "[number of things on the wall in words] bottle[s] of beer".</syntaxhighlight>
 
=={{header|Intercal}}==
See [[99 Bottles of Beer/EsoLang]]
 
=={{header|Io}}==
Line 5,563 ⟶ 5,953:
)
)</syntaxhighlight>
 
=={{header|Intercal}}==
<syntaxhighlight lang="intercal">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</syntaxhighlight>
 
=={{header|Ioke}}==
Line 5,591 ⟶ 6,284:
2 bottles of beer on the wall, 2 bottles of beer; take one down and pass it around, 1 bottle of beer on the wall
1 bottle of beer on the wall, 1 bottle of beer; take one down and pass it around, 0 bottles of beer on the wall </pre>
 
=={{header|Jakt}}==
<syntaxhighlight lang="jakt">
fn bottle_string(bottle_count: i64) throws -> String => match bottle_count {
0 => "No more bottles"
1 => "1 bottle"
else => format("{} bottles", bottle_count)
}
 
fn main() {
mut bottle_count = 99
while bottle_count > 0 {
println("{} of beer on the wall", bottle_string(bottle_count))
println("{} of beer", bottle_string(bottle_count))
println("Take one down, pass it around")
bottle_count--
println("{} of beer on the wall", bottle_string(bottle_count))
 
if bottle_count > 0 {
println("")
}
}
}
</syntaxhighlight>
 
=={{header|Janet}}==
<syntaxhighlight lang="janet">
(defn bottles [n]
(match n
0 "No more bottles"
1 "1 bottle"
_ (string n " bottles")))
 
(loop [i :down [99 0]]
(print
(bottles i) " of beer on the wall\n"
(bottles i) " of beer\nTake one down, pass it around\n"
(bottles (- i 1)) " of beer on the wall\n\n"))
</syntaxhighlight>
 
=={{header|Java}}==
Line 6,115 ⟶ 6,847:
Take one down, pass it around
0 bottles of beer on the wall
</syntaxhighlight>
 
=={{header|Lang}}==
<syntaxhighlight lang="lang">
$i = 99
until($i == 0) {
fn.println($i bottles of beer on the wall)
fn.println($i bottles of beer)
fn.println(Take one down, pass it around)
$i -= 1
if($i > 0) {
fn.println($i bottles of beer)
fn.println()
}else {
fn.println(No more bottles of beer on the wall)
}
}
</syntaxhighlight>
 
Line 7,245 ⟶ 7,996:
(if i == 1 then " bottle" else " bottles") + " of beer\nTake one down, pass it around\n" + (i - 1) as string + (if i - 1 == 1 then "\
bottle" else " bottles") + " of beer on the wall\n" + (if i - 1 == 0 then "\nno more beer" else "")))</syntaxhighlight>
 
=={{header|MEL}}==
<syntaxhighlight lang="mel">// Rosetta Code problem: https://rosettacode.org/wiki/99_bottles_of_beer
// by Jjuanhdez, 10/2022
 
string $temp0[] , $temp1[] , $text0 , $text1;
string $theGrp = `group -em`;
for ($i = 99 ; $i > -1 ; $i--)
{
$text0 = string($i) + " bottles of beer on the wall, " + string($i) +" bottles of beer.";
$text1 = "Take one down and pass it around, " + string($i-1) +" bottles of beer on the wall.";
if ($i == 1)
{
$text0 = string($i) + " bottle of beer on the wall, " + string($i) +" bottle of beer.";
$text1 = "Take one down and pass it around, no more bottles of beer on the wall.";
}
if ($i == 0)
{
$text0 = "No more bottles of beer on the wall, no more bottles of beer. ";
$text1 = "Go to the store and buy some more, 99 bottles of beer on the wall.";
}
$temp0 = `textCurves -ch 0 -f "Times New Roman|h-13|w400|c0" -t ($text0)`;
$temp1 = `textCurves -ch 0 -f "Times New Roman|h-13|w400|c0" -t ($text1)`;
setAttr ($temp0[0] + ".ty") (($i * 8) + 3);
setAttr ($temp1[0] + ".ty") ($i * 8);
parent $temp0[0] $theGrp ;
parent $temp1[0] $theGrp ;
}</syntaxhighlight>
 
=={{header|Mercury}}==
Line 7,463 ⟶ 8,242:
end
</syntaxhighlight>
 
=={{header|Miranda}}==
<syntaxhighlight lang="miranda">main :: [sys_message]
main = map (Stdout . verse) [99, 98 .. 1]
 
verse :: num->[char]
verse n = lay [bottles n ++ " of beer on the wall,",
bottles n ++ " of beer,",
"Take " ++ pronoun ++ " down and pass it around,",
bottles (n-1) ++ " of beer on the wall!",
[]]
where pronoun = "it", if n=1
= "one", otherwise
 
bottles :: num->[char]
bottles n = "No more bottles", if n=0
= "1 bottle", if n=1
= (show n) ++ " bottles", otherwise</syntaxhighlight>
 
=={{header|mIRC Scripting Language}}==
Line 7,757 ⟶ 8,554:
=={{header|Monkey}}==
Tic's every one and a half seconds and sings(text's) the song out.
<Langsyntaxhighlight lang="monkey">
 
Import mojo
Line 7,834 ⟶ 8,631:
End
 
 
</syntaxhighlight>
 
Line 7,960 ⟶ 8,755:
<div>
mydef_page -mgeneral bottles.def
</div>
It outputs bottles.txt, which contains the lyrics.
 
Line 8,299 ⟶ 9,094:
70 PRINT BOTTLES-1 BOTTLES$ WALL$
80 NEXT</syntaxhighlight>
 
=={{header|Nutt}}==
<syntaxhighlight lang="Nutt">
module main imports native.io.output.say
 
for i|->{1,2..99;<|>) do
say(""+i+" bottles of beer on the wall, "+i+" bottles of beer")
say("Take one down and pass it around, "+(i-1)+" bottles of beer on the wall.")
done
 
end
</syntaxhighlight>
 
=={{header|OASYS}}==
Line 8,814 ⟶ 9,621:
=={{header|Pascal}}==
See [[99 Bottles of Beer/Pascal]]
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
begin
for var i:=99 to 1 step -1 do
begin
Println(i,'bottles of beer on the wall');
Println(i,'bottles of beer');
Println('Take one down, pass it around');
Println(i-1,'bottles of beer on the wall');
Println
end;
end.</syntaxhighlight>
 
=={{header|Perl}}==
Line 9,171 ⟶ 9,991:
S = S1.
</syntaxhighlight>
 
=={{header|PicoLisp}}==
See [[99 Bottles of Beer/Lisp]]
 
=={{header|Piet}}==
Line 9,266 ⟶ 10,089:
end
.end</syntaxhighlight>
 
=={{header|Plain English}}==
<syntaxhighlight lang="text">
To run:
Start up.
Sing 99 of bottles of beer on the wall.
Wait for the escape key.
Shut down.
 
To sing a number of bottles of beer on the wall:
Put the number into a counter.
Loop.
Write the first line given the counter.
Write the second line given the counter.
Write "Take one down, pass it around" to the console.
Subtract 1 from the counter.
Write the first line given the counter.
If the counter is 0, break.
Write "" on the console.
Repeat.
 
To write the first line given a counter:
If the counter is 0, write "No more bottles of beer on the wall" to the console; exit.
If the counter is 1, write "1 bottle of beer on the wall" to the console; exit.
Write the counter then " bottles of beer on the wall" to the console.
 
To write the second line given a counter:
If the counter is 1, write "1 bottle of beer" to the console; exit.
Write the counter then " bottles of beer" to the console.
</syntaxhighlight>
 
=={{header|PlainTeX}}==
Line 9,632 ⟶ 10,485:
=={{header|Python}}==
===One line===
{{Works with|Python|3.86+}}
 
Quite a shortShort, one-line version.
 
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">for i in range(99, 0, -1): b ='bottles of beer'; w = b + ' on the wall'; print(f'{i} {w}, {i} {b}\nTake one down and pass it around, {i - 1} {w}.\n')
for i in range(99, 0, -1):b='bottles of beer';w=f' {b} on the wall';print(f'{i}{w}, {i} {b}\nTake one down and pass it around, {i-1}{w}.\n')
</syntaxhighlight>
 
===Pythonic version===
Unfortunately, '''it is not a good example''' of how to write in Python. The last verse is different than it should be. It should be (according to the canonical text) "Go to the store and buy some more, 99 bottles of beer on the wall". Moreover, the grammar is not correct: it always writes "bottles" even when there is one bottle. Another problem is the obvious violation of PEP8, see https://www.python.org/dev/peps/pep-0008.
{{Works with|Python|3}}
 
<syntaxhighlight lang="python">
{{output}}
VERSE = '''\
To save space, some of the text was of course omitted.
{n} bottle{s} of beer on the wall
 
{n} bottle{s} of beer
<pre>99 bottles of beer on the wall, 99 bottles of beer
Take one down and, pass it around, 98 bottles of beer on the wall.
{n_minus_1} bottle{s2} of beer on the wall
 
98 bottles of beer on the wall, 98 bottles of beer
Take one down and pass it around, 97 bottles of beer on the wall.
 
...
 
3 bottles of beer on the wall, 3 bottles of beer
Take one down and pass it around, 2 bottles of beer on the wall.
 
2 bottles of beer on the wall, 2 bottles of beer
Take one down and pass it around, 1 bottles of beer on the wall.
 
1 bottles of beer on the wall, 1 bottles of beer
Take one down and pass it around, 0 bottles of beer on the wall.
</pre>
 
===PEP8 compilant===
{{Works with|Python|3.7}}
 
Version with correct grammar and correct ending ("no more bottles ..."). The problem that has not been solved is that the number of bottles is written in numbers, not in words. The program is '''PEP8 compliant''' and remains readable even to those unfamiliar with Python.
 
<syntaxhighlight lang="python">#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
"""Pythonic 99 beer song (maybe the simplest naive implementation in Python 3)."""
 
 
REGULAR_VERSE = '''\
{n} bottles of beer on the wall, {n} bottles of beer
Take one down and pass it around, {n_minus_1} bottles of beer on the wall.
 
'''
 
ENDING_VERSES = '''\
2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.
 
for n in range(99, 0, -1):
1 bottle of beer on the wall, 1 bottle of beer.
if n == 1:
Take one down and pass it around, no more bottles of beer on the wall.
n_minus_1 = 'No more'
 
s = ''
No more bottles of beer on the wall, no more bottles of beer.
s2 = 's'
Go to the store and buy some more, 99 bottles of beer on the wall.
elif n == 2:
 
n_minus_1 = n - 1;
'''
s = 's'
 
s2 = ''
 
else:
for n in range(99, 2, -1):
print(REGULAR_VERSE.format(n=n, n_minus_1 = n - 1));
s = 's'
print(ENDING_VERSES)
s2 = 's'
print(VERSE.format(n=n, s=s, s2=s2, n_minus_1=n_minus_1))
</syntaxhighlight>
 
Line 10,781 ⟶ 11,608:
bottles n - 1 "of beer on the wall" crlf
]]</syntaxhighlight>
 
=={{header|Refal}}==
<syntaxhighlight lang="refal">$ENTRY Go {
= <Prout <Verses 99>>;
};
 
Verses {
'-'1 = ;
s.1 = <Verse s.1>
<Verses <- s.1 1>>;
};
 
Verse {
s.1 = <Bottles s.1> ' of beer on the wall,\n'
<Bottles s.1> ' of beer,\n'
<ThirdLine s.1> '\n'
<Bottles <- s.1 1>> ' of beer on the wall!\n\n';
};
 
Bottles {
'-'1 = '99 bottles';
0 = 'No more bottles';
1 = '1 bottle';
s.1 = s.1 'bottles';
};
 
ThirdLine {
0 = 'Go to the store and buy some more,';
1 = 'Take it down and pass it around,';
s.1 = 'Take one down and pass it around,';
};</syntaxhighlight>
 
=={{header|Relation}}==
Line 11,056 ⟶ 11,914:
</syntaxhighlight>
 
=={{header|RPL}}==
≪ " bottles" " of beer" " on the wall" "Take one down and pass it around,"
→ n b of on take
≪ n 1 '''FOR''' j
j →STR b + of + DUP on + "," + 1 DISP
"," + 2 DISP
take 3 DISP
j 1 ≠ LAST - →STR "No more" IFTE
b +
'''IF''' j 2 == '''THEN''' 1 OVER SIZE 1 - SUB '''END'''
of + on + "." + 4 DISP
-1 '''STEP'''
≫ ≫ '<span style="color:blue">BOB</span>' STO
 
99 <span style="color:blue">BOB</span>
=={{header|RPL/2}}==
===Simple solution===
Line 11,557 ⟶ 12,430:
set ? 9
> EOF</syntaxhighlight>
 
=={{header|Shen}}==
See [[99 Bottles of Beer/Lisp]]
 
=={{header|Shiny}}==
Line 11,735 ⟶ 12,611:
(v ~~ 0) ifTrue: [ Transcript show: (sr at:4) ; cr. ].
].</syntaxhighlight>
 
 
This version uses Squeak Smalltalk's String >> format: method. and SequencableCollection >> atPin: method
<syntaxhighlight lang="smalltalk">
|bottles plurals |
Transcript clear.
bottles:='{1} bottle{2} of beer on the wall
{1} bottle{2} of beer
Take one down, pass it around
{3} bottle{4} of beer on the wall'.
plurals := #('' 's').
99 to: 1 by: -1 do:[:v |
Transcript show: (bottles format: {(v asString) . (plurals atPin:v) . ((v -1) asString). (plurals atPin:v) }); cr; cr].
 
Transcript show: 'hic!'; cr.
 
</syntaxhighlight>
 
 
This version uses Squeak Smalltalk's String >> asPluralBasedOn: method to handle the plural and singular cases.
<syntaxhighlight lang="smalltalk">
 
| bottles |
Transcript clear.
bottles := '{1} {2} of beer on the wall
{1} {2} of beer
Take one down, pass it around
{3} {4} of beer on the wall'.
99 to: 1 by: -1 do: [:i |
Transcript
show: (bottles format: {
i. 'bottle' asPluralBasedOn: i.
i - 1. 'bottle' asPluralBasedOn: i - 1});
cr; cr].
Transcript show: 'hic!'; cr.
</syntaxhighlight>
 
=={{header|SmileBASIC}}==
Line 11,838 ⟶ 12,750:
=={{header|SNUSP}}==
See [[99 Bottles of Beer/EsoLang]]
 
=={{header|SparForte}}==
As a structured script.
<syntaxhighlight lang="ada">#!/usr/local/bin/spar
pragma annotate( summary, "bottles" );
pragma annotate( description, "In this puzzle, write code to print out the entire '99 bottles of beer" );
pragma annotate( description, "on the wall' song. A common interview test from Rosetta Code for" );
pragma annotate( description, "testing basic programming skills." );
pragma annotate( author, "Ken O. Burtch" );
pragma license( unrestricted );
 
pragma restriction( no_external_commands );
 
procedure Bottles is
begin
for X in reverse 1..99 loop
? strings.image( X ) & " bottles of beer on the wall";
? strings.image( X ) & " bottles of beer";
? "Take one down, pass it around";
? strings.image( integer(X-1) ) & " bottles of beer on the wall" @ "";
end loop;
end Bottles;</syntaxhighlight>
 
=={{header|Sparkling}}==
Line 12,129 ⟶ 13,063:
</syntaxhighlight>
 
=={{header|SuperTalk}}==
<syntaxhighlight lang="supertalk">-- Rosetta Code problem: https://rosettacode.org/wiki/99_bottles_of_beer
-- by Jjuanhdez, 10/2022
 
=={{header|xTalk}}==
<syntaxhighlight lang="livecode">
function beerMe numberOfBottles
   put "XX bottles of beer on the wall" into verseA
   put "Take one down, pass it around" into verseB
   repeat with N = numberOfBottles down to 1
      put replaceText(verseA,"XX",N) & cr & word 1 to 4 of \
replaceText(verseA,"XX",N) & cr & verseB & cr & replaceText(verseA,"XX",N-1) \
& cr & cr after theSong
   end repeat
   return theSong
end beerMe
</syntaxhighlight>
 
<syntaxhighlight lang="supertalk">
on mouseup
 
put 99 into numBeerz
put "s it" into modifier
repeat with x = numBeerz down to 1
put "one" into whichone
put "s" into modifier
put "s" into otherModifier
put x - 1 into nextCount
if x is 2 then put "" into otherModifier
if x is 1 then
put "it" into whichone
put "" into modifier
put "s" into otherModifier
put "no more" into nextCount
end if
 
put x & " bottle" & modifier& " of beer on the wall, " & x & " bottle" & modifier & " of beer..." after y
modifier & " of beer..." after y
put " Take " & whichOne & " down and pass it around, " & nextCount & " bottle" & otherModifier & " of beer on the wall. " & cr after y
put " Take " & whichOne & " down, pass it around, " & nextCount & "
bottle" & otherModifier & " of beer on the wall. " & cr after y
end repeat
put "No more bottles of beer on the wall, noya morebastards bottlesdrank ofthem beer."all! &So cr after y
put "Gooff to the store to buy some more, let's put 99 bottles of beer on the wall!" & cr after y
wall!" & cr after y
 
put y into card field 1
-- say cd fld 1 -- uncomment this line to hear it sing.
 
end mouseup</syntaxhighlight>
 
</syntaxhighlight>
 
=={{header|Swift}}==
Line 12,284 ⟶ 13,209:
}
</syntaxhighlight>
 
=={{header|Transd}}==
<syntaxhighlight lang="Scheme">#lang transd
 
class MaterialAssets: {
what: (λ (textout quantity " " contents " ")),
consume: (λ (-= quantity 1)),
thereIs: (λ (ret quantity)),
quantity: Int(),
contents: String(),
@init: (λ _q Int(0) _c String()
(= quantity _q) (= contents _c))
}
 
class Storage: {
where: (λ (textout container)),
container: String(),
@init: (λ _c String() (= container _c))
}
 
class Activity: {
do: (λ (textout action) (consume stuff)),
provideStuff: (λ _s MaterialAssets() (rebind stuff _s)),
action: String(),
@init: (λ _a String() (= action _a)),
stuff: MaterialAssets()
}
 
class PartyMaker: {
letsRock: (λ
(while (thereIs stuff)
(what stuff) (where box) (lout "")
(what stuff) (lout "")
(do fun) (lout "")
(what stuff) (where box) (lout "\n"))
(lout "OK! What about one more?")
),
stuff: MaterialAssets(),
box: Storage(),
fun: Activity(),
@init: (λ _s MaterialAssets() _b Storage() _f Activity()
(rebind stuff _s) (rebind box _b) (rebind fun _f)
(provideStuff fun stuff))
}
 
MainModule: {
_start: (λ
locals: party PartyMaker(
MaterialAssets(99 "bottles of beer")
Storage("on the wall")
Activity("Take one down, pass it around"))
(letsRock party)
)
}</syntaxhighlight>
 
=={{header|TUSCRIPT}}==
Line 12,481 ⟶ 13,461:
 
main = whole_song 99</syntaxhighlight>
 
=={{header|Uxntal}}==
<syntaxhighlight lang="Uxntal">( uxncli 99bottles.rom )
 
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
 
|0100 ( -> )
#63 &loop
DUP <print-verse>
[ LIT2 0a -Console/write ] DEO
#01 EQUk ?&done
POP #01 SUB
!&loop
&done BRK
 
@<print-verse> ( num -- )
DUP <print-bottle> ;dict/wall <print-string>
DUP <print-bottle> [ LIT2 0a -Console/write ] DEO
;dict/take <print-string>
#01 SUB <print-bottle> ;dict/wall !<print-string>
 
@<print-bottle> ( num -- )
DUP #00 EQU ?&zero
DUP #01 EQU ?&one
<print-dec> ;dict/bottle <print-string>
[ LIT2 "s -Console/write ] DEO
!&end
 
&one ( num -- )
<print-dec> ;dict/bottle <print-string>
!&end
&zero ( num -- )
POP ;dict/no-more <print-string>
;dict/bottle <print-string>
[ LIT2 "s -Console/write ] DEO
( >> )
&end
;dict/of-beer
( >> )
 
@<print-string> ( str -- )
&loop
LDAk .Console/write DEO
INC2 LDAk ?&loop
POP2 JMP2r
 
@<print-dec> ( byte -- )
DUP #64 DIV <print-num>/try
DUP #0a DIV <print-num>/try
( >> )
 
@<print-num> ( num -- )
#0a DIVk MUL SUB
[ LIT "0 ] ADD .Console/write DEO
JMP2r
 
&try ( num -- )
DUP ?<print-num>
POP JMP2r
 
@dict &no-more "No 20 "more $1
&bottle 20 "bottle $1
&of-beer 20 "of 20 "beer 20 $1
&wall "on 20 "the 20 "wall 0a $1
&take "Take 20 "one 20 "down, 20 "pass 20 "it 20 "around 0a $1</syntaxhighlight>
 
=={{header|UTFool}}==
Line 12,504 ⟶ 13,549:
</syntaxhighlight>
 
=={{header|VV_(Vlang)}}==
<syntaxhighlight lang="v">[bottles
[newline '' puts].
Line 12,715 ⟶ 13,760:
</syntaxhighlight>
 
=={{header|V (Vlang)}}==
 
Fails the task definition for more song, includes the no beer verse.
Line 12,804 ⟶ 13,849:
 
=={{header|Whenever}}==
See [[99 Bottles of Beer/EsoLang]]
 
=={{header|Whitespace}}==
See [[99 Bottles of Beer/EsoLang]]
 
Line 12,833 ⟶ 13,881:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">for (i in 99...0) {
System.print("%(i) bottles of beer on the wall,")
System.print("%(i) bottles of beer,")
System.print("Take one down, pass it around,")
System.print("%(i - 1) bottles of beer on the wall.\n")
}</syntaxhighlight>
 
Line 13,081 ⟶ 14,129:
</xsl:template>
</xsl:stylesheet></syntaxhighlight>
 
=={{header|xTalk}}==
<syntaxhighlight lang="livecode">
function beerMe numberOfBottles
   put "XX bottles of beer on the wall" into verseA
   put "Take one down, pass it around" into verseB
   repeat with N = numberOfBottles down to 1
      put replaceText(verseA,"XX",N) & cr & word 1 to 4 of \
replaceText(verseA,"XX",N) & cr & verseB & cr & replaceText(verseA,"XX",N-1) \
& cr & cr after theSong
   end repeat
   return theSong
end beerMe
</syntaxhighlight>
 
=={{header|Yabasic}}==
Line 13,103 ⟶ 14,165:
</syntaxhighlight>
 
 
=={{header|YAMLScript}}==
<syntaxhighlight lang="yaml">
#!/usr/bin/env ys-0
 
# Print the verses to "99 Bottles of Beer"
#
# usage:
# ys 99-bottles.ys [<count>]
 
defn main(number=99):
each [n (number .. 1)]:
say: paragraph(n)
 
defn paragraph(num): |
$bottles(num) of beer on the wall,
$bottles(num) of beer.
Take one down, pass it around.
$bottles(num - 1) of beer on the wall.
 
defn bottles(n):
cond:
n == 0 : 'No more bottles'
n == 1 : '1 bottle'
=> : "$n bottles"
</syntaxhighlight>
 
=={{header|Yorick}}==
Line 13,126 ⟶ 14,214:
See [[99 Bottles of Beer/Assembly]]
 
=={{header|Zig}}==
{{trans|C}}
<syntaxhighlight lang="zig">const print = @import("std").debug.print;
pub fn main() void {
var i: u8 = 99;
while (i > 2) : (i-= 1) {
print(
\\{} bottles of beer on the wall, {} bottles of beer.
\\Take one down and pass it around, {} bottles of beer on the wall.
\\
\\
, .{i, i, i-1});
}
print(
\\2 bottles of beer on the wall, 2 bottles of beer.
\\Take one down and pass it around, 1 bottle of beer on the wall.
\\
\\1 bottle of beer on the wall, 1 bottle of beer.
\\Take one down and pass it around, no more bottles of beer on the wall.
\\
\\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.
, .{});
}</syntaxhighlight>
=={{header|zkl}}==
<syntaxhighlight lang="zkl">[99..0,-1].pump(fcn(n){
50

edits