This commit is contained in:
Vitor Oliveira 2021-09-03 13:30:10 -07:00
parent 351bdc393f
commit 12c69e8429

View file

@ -33,18 +33,18 @@
def fizz_buzz(n)
str = []
fizz_buzz = {}
fizz_buzz[3] = "Fizz"
fizz_buzz[5] = "Buzz"
fizz_buzz[3] = 'Fizz'
fizz_buzz[5] = 'Buzz'
n.times do |i|
i += 1
num_str = ""
num_str = ''
fizz_buzz.each do |key, value|
num_str += value if i % key == 0
end
num_str = i.to_s if num_str == ""
num_str = i.to_s if num_str == ''
str.push(num_str)
end