Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: 99 bottles, 2 lines -Didnt login- hehe

by Anonymous Monk
on Aug 04, 2003 at 00:28 UTC ( #280531=note: print w/replies, xml ) Need Help??

in reply to 99 bottles, 2 lines -Didnt login- hehe
in thread 99 bottles, 2 lines

got it even smaller (126 bytes)

@a=(" bottles of beer",'on the wall ');die map{"$_@a$_$a[0]\nTake one down, pass it around\n".(--$_||No)."@a\n"}reverse(1..99)
  • Comment on Re: 99 bottles, 2 lines -Didnt login- hehe

Replies are listed 'Best First'.
Re: Re: 99 bottles, 2 lines -Didnt login- hehe
by balou (Initiate) on Aug 04, 2003 at 00:31 UTC
    oh no... forgot to login too *g*
      129, and properly decrements the count inside of the verse

      $i=99;$b="bottles of beer";$o=" on the wall";while($i){print "$i $b$o, $i $b\nTake one down, pass it around\n",--$i," $b$o!\n\n"}

      186, but accounts for the fact that you would say 1 bottle but still say 0 bottles.

      $i=99;$f=" of beer";$o=" on the wall";while($i){$b="bottle";$b.="s"if$i!=1;print" $b$f$o\n\n"if$i!=99;print"$i $b$f$o, $i $b$f\nTake one down, pass it around, ",--$i}print" ${b}s$f$o\n";


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://280531]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-05-26 22:05 GMT
Find Nodes?
    Voting Booth?