Last active
June 12, 2016 22:10
-
-
Save rosslebeau/3c860fc43aec7f203a0bde2fc98e1ac4 to your computer and use it in GitHub Desktop.
An insane, one-line solution to FizzBuzz in Ruby, using no conditionals.
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 fizzbuzz(start, limit) loop do puts "#{'fizz' * (((start % 3 / (start % 3 + 1.0)).ceil - 1) * (-1))}#{'buzz' * (((start % 5 / (start % 5 + 1.0)).ceil - 1) * (-1))}#{start.to_s * ((start % 3 / (start % 3 + 1.0)).ceil * ((start % 5) / ((((start += ((limit + 1) - start)/((limit + 1) - start)) - 1) % 5) + 1.0)).ceil)}" end end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment