Skip to content

Instantly share code, notes, and snippets.

@gabrielmansour
Created June 7, 2013 00:06
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 gabrielmansour/5726101 to your computer and use it in GitHub Desktop.
Save gabrielmansour/5726101 to your computer and use it in GitHub Desktop.
The solution to a modified version of the FizzBuzz challenge.
# 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