From: Edwin Fine Date: 2007-02-23T15:27:40+09:00 Subject: Re: Trade-off between variable name descriptiveness and read 99 programmers will have 99 different solutions, so here's mine ;-) BTW, I'm with David Vallner; make the loop index a short name and decorate it another way. I've tried at the same time to make the DRY concept sink in. # Make the singer look a bit intelligent :) def bottles(n) case n when 0 "no more bottles" when 1 "1 lonely bottle" else "#{n} bottles" end end def sing_song(starting_bottles) starting_bottles.downto(1) do |n| num_bottles = bottles(n) puts "#{num_bottles} of beer on the wall, #{num_bottles} of beer!" num_bottles = bottles(n - 1) # One down puts "Take one down, pass it around, #{num_bottles} of beer on the wall." puts end end irb(main):047:0> sing_song 3 3 bottles of beer on the wall, 3 bottles of beer! Take one down, pass it around, 2 bottles of beer on the wall. 2 bottles of beer on the wall, 2 bottles of beer! Take one down, pass it around, 1 lonely bottle of beer on the wall. 1 lonely bottle of beer on the wall, 1 lonely bottle of beer! Take one down, pass it around, no more bottles of beer on the wall. My $0.02. -- Posted via http://www.ruby-forum.com/.