Skip to content

Instantly share code, notes, and snippets.

@MrBean83
Last active December 20, 2015 07:28
Show Gist options
  • Select an option

  • Save MrBean83/6093186 to your computer and use it in GitHub Desktop.

Select an option

Save MrBean83/6093186 to your computer and use it in GitHub Desktop.
Implement FizzBuzz (Super Edition)
def super_fizzbuzz(array)
new_arr = []
array.each do |num|
if ((num % 3 == 0) && (num % 5 == 0))
new_arr << "FizzBuzz"
elsif num % 3 == 0
new_arr << "Fizz"
elsif num % 5 == 0
new_arr << "Buzz"
else
new_arr << num
end
end
new_arr
end
@zdavy
Copy link

zdavy commented Jul 27, 2013

this could work, instead of puts, do num = "FizzBuzz"

@MrBean83
Copy link
Author

Zach, I tried the 'num = "...."' way and that didn't pass =/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment