Skip to content

Instantly share code, notes, and snippets.

@jjasghar jjasghar/bottles.rb
Created Dec 6, 2016

Embed
What would you like to do?
class Bottles
def verse(number)
case number
when 1
orig_bottles = "bottle"
new_bottles = "no more bottles"
space = ""
one = "it"
when 2
orig_bottles = "bottles"
new_bottles = "bottle"
space = " "
one = "one"
else
orig_bottles = "bottles"
new_bottles = "bottles"
space = " "
one = "one"
end
knock_one_down = remove(number)
"#{number} #{orig_bottles} of beer on the wall, #{number} #{orig_bottles} of beer.
Take #{one} down and pass it around, #{knock_one_down}#{space}#{new_bottles} of beer on the wall.
"
end
def remove(number)
case number
when 1
""
else
number-1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.