Created
July 4, 2016 23:23
-
-
Save MaggieMoss/05e5b380c9727934802ca591581c81ef to your computer and use it in GitHub Desktop.
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
# tonight we went over how to solve fizzbuzz | |
# see if you can try to improve our solution. | |
numbers = (1..100) # [1, 2, 3, 4, 5, 6 .. 100] | |
numbers.each do |number| | |
if number % 5 == 0 && number % 3 == 0 | |
puts "FizzBuzz" | |
elsif number % 5 == 0 | |
puts "Buzz" | |
elsif number % 3 == 0 | |
puts "Fizz" | |
else | |
puts number | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment