Newbie - Grade My Method?

Hi all,

I’m trying to teach myself Ruby with the hope of doing a RoR bootcamp.

I’m totally new to programming… can you please give me feedback!

Write a program which iterates through numbers from 1 to n,

and prints “fiz” if the number is divisible by 3, “buz” if it is

divisible by 5, and “fizbuz” if it is divisible by both 3 and 5.

def fizz(*numbers)
numbers.each do |i|
if i % 3 == 0 && i % 5 == 0
puts “#{i} is fizbuz cause it’s divisible by both 3 and 5.”
elsif i % 3 == 0
puts “#{i} is fiz cause it’s divisible by 3.”
elsif i % 5 == 0
puts “#{i} is buz cause it’s divisible by 5.”
else
puts “#{i} is not divisible by 3 or 5 – FAIL!”
end
end
end

puts fizz(3, 13, 29, 65, 97)

Read back through the description, from 1 to n. That means a range, like
1…5, and it wants you to print exactly as it says. This is typically
the
first problem for weeding out newbies. Personally I’d fail you because
you
didn’t do things exactly like the specification.

Look into: Range, Implicit Returns, and Print.