Skip to content

Instantly share code, notes, and snippets.

@john-crossley
Last active December 21, 2015 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-crossley/6326972 to your computer and use it in GitHub Desktop.
Save john-crossley/6326972 to your computer and use it in GitHub Desktop.
Just a random FizzBuzz example written in Ruby
#!/usr/bin/ruby
i = 1
num = rand(100..1000)
until i > num do
if i % 3 == 0 and i % 5 == 0
puts "FizzBuzz"
elsif i % 3 == 0
puts "Fizz"
elsif i % 5 == 0
puts "Buzz"
else
puts i
end
i = i + 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment