Skip to content

Instantly share code, notes, and snippets.

@tomohiro
Created December 28, 2009 12:44
Show Gist options
  • Save tomohiro/264652 to your computer and use it in GitHub Desktop.
Save tomohiro/264652 to your computer and use it in GitHub Desktop.
FizzBuzz by Ruby
(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