Create a gist now

Instantly share code, notes, and snippets.

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