Skip to content

Instantly share code, notes, and snippets.

@vderyagin
Created October 29, 2011 08:32
Show Gist options
  • Save vderyagin/1324236 to your computer and use it in GitHub Desktop.
Save vderyagin/1324236 to your computer and use it in GitHub Desktop.
FizzBuzz
1.upto(100) do |number|
str = ''
str << 'Fizz' if (number % 3).zero?
str << 'Buzz' if (number % 5).zero?
str << number.to_s if str.empty?
puts str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment