Skip to content

Instantly share code, notes, and snippets.

@jjasghar
Created December 6, 2016 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjasghar/e52c978554461247427a11fd96e87696 to your computer and use it in GitHub Desktop.
Save jjasghar/e52c978554461247427a11fd96e87696 to your computer and use it in GitHub Desktop.
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