Can someone please explain why the following code does not work properly? It only returns "fizzbuzz" 100 times as the answer. Thank you.
def fizzbuzz(number)
idx = 0
while idx <= number
num = number[idx]
if num % 3 == 0 && num % 5 == 0
puts 'fizzbuzz'
elsif num % 5 == 0
puts 'buzz'
elsif num % 3 == 0
puts 'fizz'
else
puts num
end
idx += 1
end
end
fizzbuzz(100)