Skip to content

Instantly share code, notes, and snippets.

@cbojar
Created December 11, 2012 16:50
Show Gist options
  • Save cbojar/4260215 to your computer and use it in GitHub Desktop.
Save cbojar/4260215 to your computer and use it in GitHub Desktop.
FizzBuzz in Ruby
#!/usr/bin/ruby
1.upto(100) do |i|
div3 = (i%3).zero?
div5 = (i%5).zero?
print "Fizz" if div3
print "Buzz" if div5
print i unless div3 or div5
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment