Skip to content

Instantly share code, notes, and snippets.

@MacoTasu
Created February 17, 2017 07:39
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 MacoTasu/42c9193a233c7f93b422255142d25125 to your computer and use it in GitHub Desktop.
Save MacoTasu/42c9193a233c7f93b422255142d25125 to your computer and use it in GitHub Desktop.
fizzbuzz
# 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