Last active
December 20, 2015 07:28
-
-
Save MrBean83/6093186 to your computer and use it in GitHub Desktop.
Implement FizzBuzz (Super Edition)
This file contains hidden or 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 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 | |
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
this could work, instead of puts, do num = "FizzBuzz"