User:Frantik/99bottles

From The 3geez Wiki
< User:Frantik
Revision as of 12:13, 24 July 2007 by Frantik (talk | contribs)

(diff) ←Older revision | Latest revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
function formatNum($num)
{        
      return (($num) ? $num : 'no more') . ' bottle' . (($num == 1) ? '' : 's');
} 

for ($i = 99; $i >= 0; $i--)
{
   $bottles = formatNum($i);
   echo ucfirst($bottles) . " of beer on the wall, $bottles of beer.\n" .
            ($i ?
              "Take one down and pass it around, " .  formatNum($i - 1) :                                 
              "Go to the store and buy some more, 99 bottles"
             ) . " of beer on the wall.\n\n";}   

{{#function|formatNum|| {{#if|{{#1}}|{{#1}}|no more}} bottle{{#if|{{#1 == 1}}| | s}}}}

{{#for|{{#i @= 99}}||{{#i >= 0}}||{{#i --}}|| {{#bottles | @= | {{#formatNum|{{#i}}}} }}

{{#bottles}} of beer on the wall, {{#bottles}} of beer.
{{#if | {{#i}} | Take one down and pass it around, {{#formatNum|{{#i - 1}}}} | Go to the store and buy some more, 99 bottles }} of beer on the wall

}}