99 Bottles of Beer/Pascal

From Rosetta Code
Revision as of 05:18, 21 November 2014 by rosettacode>Hajo (99 Bottles of Beer done in Pascal-languages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
99 Bottles of Beer/Pascal is part of 99 Bottles of Beer. You may find other members of 99 Bottles of Beer at Category:99 Bottles of Beer.

99 Bottles of Beer done in Pascal-languages


Pascal

<lang pascal>procedure BottlesOfBeer; var

 i: Integer;

begin

 for i := 99 downto 1 do
 begin
   if i = 1 then
   begin
     WriteLn('1 bottle of beer on the wall');
     WriteLn('1 bottle of beer');
     WriteLn('Take one down, pass it around');
     WriteLn('No more bottles of beer on the wall');
     Exit;
   end;
   WriteLn(Format('%d bottles of beer on the wall', [i]));
   WriteLn(Format('%d bottles of beer', [i]));
   WriteLn('Take one down, pass it around');
   WriteLn(Format('%d bottles of beer on the wall', [Pred(i)]));
   WriteLn();
 end;

end;</lang>