Last active
December 21, 2015 15:29
-
-
Save john-crossley/6326972 to your computer and use it in GitHub Desktop.
Just a random FizzBuzz example written in Ruby
This file contains 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
#!/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