Created
December 28, 2009 12:44
-
-
Save tomohiro/264652 to your computer and use it in GitHub Desktop.
FizzBuzz by Ruby
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
(1..50).each do |x| | |
puts case | |
when x % 15 == 0 : 'FizzBuzz' | |
when x % 3 == 0 : 'Fizz' | |
when x % 5 == 0 : 'Buzz' | |
else x | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment