Hello -- On Thu, 19 Jul 2001, Dat Nguyen wrote: > > # How to shorten the following experimental codes? > > bottle = ' bottles' > 99.downto(1) { |i| > print "\n", i, bottle, ' of beer on the wall, ', i, bottle, ' of beer', ".\n" > print 'Take one down, pass it around,', "\n" > bottle = ' bottle' if i == 2 > print i-1, bottle, ' of beer on the wall.', "\n" if i > 1 > } > print 'No bottles of beer on the wall.', "\n\n" Fewer characters, though more lines: i,w=99," on the wall" while i>1 b=proc{"#{i} bottle#{:s if i>1} of beer"} x=proc{"#{b.call}#{w}"} puts"#{x.call}, #{b.call}." puts"Take one down, pass it around,#{(i -=1).to_s*0}" puts "#{x.call}." end puts"No bottles of beer#{w}." (No claims of minimism or statement of programming philosophy, just fun :-) David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav