Created
December 6, 2016 00:20
-
-
Save jjasghar/e52c978554461247427a11fd96e87696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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