Over a million developers have joined DZone.

99 Bottles Of Beer

·
def bottle(x)
  case x
  when 0 then "no more bottles"
  when 1 then "1 bottle"
  else        "#{x} bottles"
  end + " of beer"
end

99.downto(1) do |i|
  puts <
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}