11/19 Using code blocks


#1

Hi,

I’m at stage 11/19 of the lesson, I’ve apparently passed the exercise and I can go through, but when I edit the code this way

[1, 2, 3, 4, 5].each { |i| puts i*5 }

it prints this to the console:
1 2 3 4 5 5 10 15 20 25 instead only 5 10 15 20 25 as expected.

Can someone tell me why, please? Is there something wrong with my code?

Thank you


#2

Hi there,

Simply because you’re also printing this

[1, 2, 3, 4, 5].each { |i| puts i }

Try running the code without this line if you’d like to make sure :wink:


#3

Of course, yes! :woman_facepalming:
Thanks a lot!
:upside_down_face:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.