99 bottles of beer: Difference between revisions

fix syntax highlighting
No edit summary
Tags: Mobile edit Mobile web edit
(fix syntax highlighting)
(8 intermediate revisions by 3 users not shown)
Line 66:
 
=={{header|8th}}==
<syntaxhighlight lang="forthfactor">
\ 99 bottles of beer on the wall:
: allout "no more bottles" ;
: just-one "1 bottle" ;
: yeah! dup . " bottles" ;
 
[
: allout "no more bottles" ;,
' allout ,
' just- "one bottle" ,
: yeah! ( dup . " bottles" ;)
' yeah! ,
] var, bottles
 
: .bottles dup 2 n:min bottles @ swap caseof ;
: .beer dup 2 n:min .bottles . " of beer"@ .caseof ;
: .wall .beer " on the wall" . ;
: .take " Take one down and pass it around" . ;
: beers .wall ", " . .beer '; putc cr
n:1- 0 max .take ", " .
.wall '. putc cr drop ;
 
: .beer
' beers 1 99 loop- bye
.bottles . " of beer" . ;
 
: .wall
: .wall .beer " on the wall" . ;
 
: .take
: .take " Take one down and pass it around" . ;
 
: beers
: beers .wall ", " . .beer '; putc cr
n:1- 0 max .take ", " .
.wall '. putc cr drop ;
 
' beers 1 99 loop- bye
bye
</syntaxhighlight>
 
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
Line 2,027 ⟶ 2,034:
=={{header|C/vFP16}}==
<syntaxhighlight
lang="ccpp">#pragma SCH_64_16_IFP
#import <jobsched.c>
 
Line 9,527 ⟶ 9,534:
 
=={{header|Oxygene}}==
<syntaxhighlight lang="oxygenepascal">
namespace ConsoleApplication2;
 
Line 9,561 ⟶ 9,568:
end;
 
end.
</syntaxhighlight>
 
 
This version uses top-level declarations, string interpolation along with more idiomatic Object Pascal syntax vs C#.Net syntax:
 
<syntaxhighlight lang="pascal">
namespace _99_beers;
 
method bottles(number: Integer): String;
begin
if (number = 1) then
Result := "bottle"
else
Result := "bottles";
end;
 
begin
for n: Integer := 99 downto 1 do
begin
writeLn($"{n} {bottles(n)} of beer on the wall,");
writeLn($"{n} {bottles(n)} of beer,");
writeLn($"Take one down, and pass it around,");
writeLn($"{n-1} {bottles(n-1)} of beer on the wall.");
writeLn();
end;
readLn;
end.
</syntaxhighlight>
Line 9,621 ⟶ 9,655:
=={{header|Pascal}}==
See [[99 Bottles of Beer/Pascal]]
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="pascal">
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>
 
 
This version demonstrates uses of 'writeLn' vs 'Println' as well as string interpolation:
 
<syntaxhighlight lang="pascal">
begin
for var i:=99 to 1 step -1 do
begin
writeLn($'{i} bottles of beer on the wall');
writeLn($'{i} bottles of beer');
writeLn($'Take one down, pass it around');
writeLn($'{i-1}bottles of beer on the wall');
writeLn
end;
end.
</syntaxhighlight>
 
=={{header|Perl}}==
Line 13,751 ⟶ 13,815:
Fails the task definition for more song, includes the no beer verse.
 
<syntaxhighlight lang="gov">// 99 bottles of V
module main