Created
June 7, 2013 00:06
-
-
Save gabrielmansour/5726101 to your computer and use it in GitHub Desktop.
The solution to a modified version of the FizzBuzz challenge.
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
# Given a number, write a method that outputs the following: | |
# when a multiple of 3, output "appy" | |
# when a multiple of 5, output "fizz" | |
# when a multiple of 3 and 5, output "appy-fizz" | |
# Otherwise, output "I'm all good here." | |
def appyfizz(n) | |
s = [] | |
s << "appy" if n % 3 == 0 | |
s << "fizz" if n % 5 == 0 | |
s.empty? ? "I'm all good here." : s.join('-') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment