Created
February 26, 2012 01:41
-
-
Save hiroshi-maybe/1912154 to your computer and use it in GitHub Desktop.
fizzbuzz
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
(1..1000000) .each {|i| | |
result=(i%FIZZ_NUM==0 ? "Fizz":"")+(i%BUZZ_NUM==0 ? "Buzz":"") | |
p result.empty? ? i.to_s : result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment