Created
February 17, 2017 07:39
-
-
Save MacoTasu/42c9193a233c7f93b422255142d25125 to your computer and use it in GitHub Desktop.
fizzbuzz
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
# frozen_string_literal: true | |
def fizzbuzz(number:) | |
return 'fizzbuzz' if (number % 15).zero? | |
return 'buzz' if (number % 5).zero? | |
return 'fizz' if (number % 3).zero? | |
number | |
end | |
1..15.times do |index| | |
puts fizzbuzz(number: index) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment