15 , 1 Help


#1

I have submitted the following code from the following problem:
Let's do a little review! Use .times and a block to puts the string "I'm a block!" five times.

[ "I'm a block! " ].each do |x|
puts x * 5
end

but it comes back in editor : Oops, try again. It looks like you didn't puts "I'm a block!".

any recommendation in what should I improve my code?


#2

I kind of sort it in a different way, but if someone is keen to explain why my first code did not work and following did, would be great:

5.times do
puts "I'm a block!"
end

Thank you


#3

Both codes work for me. The only difference is that the first one doesn't print a new line after each string (probably because the * operator on a string doesn't add any, which is logical). The exercise probably wanted 5 strings with 5 new line, not 1 string multiplied with 1 new line.