-
-
Save laurenachoo/2c11e31a9aa2657931e5 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
def range(a, b) | |
a.upto(b) { |x| puts fizzbuzz(x)} | |
end | |
def fizzbuzz(num) | |
if divby3(num) && divby5(num) | |
"FizzBuzz" | |
elsif divby5(num) | |
"Buzz" | |
elsif divby3(num) | |
"Fizz" | |
else | |
num | |
end | |
end | |
def divby5(num) | |
num % 5 == 0 | |
end | |
def divby3(num) | |
num % 3 == 0 | |
end | |
apple = 60 | |
banana = 80 | |
range(apple,banana) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment