Created
June 1, 2015 14:42
-
-
Save aalvarado/f288dc993a4f5847ff2e to your computer and use it in GitHub Desktop.
FizzBuzz Ruby without any integer modulus or division
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
limit = 100 | |
fizz = ['']*2 << 'fizz' | |
buzz = ['']*4 << 'buzz' | |
(1..limit).to_a.zip(fizz.cycle(limit).to_a.zip(buzz.cycle(limit).to_a)).each{ |n| puts n.join(' ') } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment