RSS
 

Fun with Ruby

14 Jun

puts "Let me sing you a song, stop me if you've heard it before…'"
count = 100
while count > 0
  puts "#{count} bottles of beer on the wall,"
  puts "#{count} bottles of beer,"
  puts "take one down, pass it around"
  puts "#{count – 1} bottles of beer"
  puts " "
  count -= 1
end
puts "OOPS! I'm out of beer!"
Fun with Ruby

Google+: View post on Google+

 

Tags:

Leave a Reply

 

 
  1. Ken Foreman

    June 14, 2012 at 10:52 am

    I love Ruby, such an elegant language. I might have to start writing all my scripts in Ruby rather than Python!

     
  2. Ken Foreman

    June 14, 2012 at 10:58 am

    "Ho! " * 3 =  _"Ho! Ho! Ho!_
    3.times {puts "Ho! "} = "Ho! Ho! Ho!"