99 Bottles of Beer/Pascal: Difference between revisions

m
Fixed syntax highlighting.
(moving code from main task-page to sub-page)
m (Fixed syntax highlighting.)
 
(5 intermediate revisions by 2 users not shown)
Line 1:
<!--
===Pascal===
-->
{{collection|99 Bottles of Beer}}
Line 6:
__toc__
 
<!--
See [[99 Bottles of Beer/Pascal]]
-->
 
<span style='font-family: "Linux Libertine",Georgia,Times,serif;font-size:150%;'>[[Component Pascal]]</span><hr>
=={{header|Component Pascal}}==
BlackBox Component Builder
<langsyntaxhighlight lang="oberon2">
MODULE BottlesOfBeer;
IMPORT StdLog;
Line 35 ⟶ 32:
END Sing;
END BottlesOfBeer.
</syntaxhighlight>
</lang>
Execute: ^Q BottlesOfBeer.Sing<br/>
Output:
Line 64 ⟶ 61:
 
 
<span style='font-family: "Linux Libertine",Georgia,Times,serif;font-size:150%;'>[[Delphi]]</span><hr>
=={{header|Delphi}}==
:''See [[#Pascal|Pascal]]''
 
:''Or
 
<langsyntaxhighlight Delphilang="delphi">program Hundred_Bottles;
 
{$APPTYPE CONSOLE}
Line 95 ⟶ 92:
End ;
 
end.</langsyntaxhighlight>
 
 
<span style='font-family: "Linux Libertine",Georgia,Times,serif;font-size:150%;'>[[Pascal]]</span><hr>
=={{header|Pascal}}==
<langsyntaxhighlight lang="pascal">procedureprogram BottlesOfBeer;
 
var
i: Integerinteger;
 
begin
for i := 99 downto 1 do
if i <> 1 then
begin
if i = 1 then begin
WriteLn(Format writeln(i, '%d bottles of beer on the wall', [i]));
begin
WriteLn writeln(i, '1 bottlebottles of beer on the wall');
WriteLn writeln('1Take one down, bottlepass ofit beeraround');
if i = 2 then
WriteLn('Take one down, pass it around');
WriteLn writeln('No moreOne bottlesbottle of beer on the wall');
Exit; else
WriteLn(Format writeln(i - 1, '%d bottles of beer on the wall', [Pred(i)]));
end;
writeln;
WriteLn(Format('%d bottles of beer on the wall', [i]));
end;
WriteLn(Format('%d bottles of beer', [i]));
else
WriteLn('Take one down, pass it around');
begin
WriteLn(Format('%d bottles of beer on the wall', [Pred(i)]));
writeln('One bottle of beer on the wall');
WriteLn('');
writeln('One bottle of beer');
end;
WriteLn writeln('Take one down, pass it around');
end;</lang>
writeln('No more bottles of beer on the wall');
end
end.</syntaxhighlight>
9,476

edits