Loops and Iterators using .each on odds not working


#1

I am on .each "Try it out!" the lesson wants .each used on odds. They give two examples and I chose to add my code using do. I submit my answer and get an Oops try again, did you remember to multiply by 2. This is the example/lesson for odds:

odds = [1,3,5,7,9]

Add your code below!

This is my code:

odds.each do |x|
x * 2
print #"{x}"
end

So what's wrong with this?


#2

Oh I fixed the print part of the statement and put the # in the parentheses also and it still does not make a difference. Any advice would be appreciated so I can move on.


#3

Issue resolved for this post. I had to clear out the cache on my computer and reload the page. I've tried multiple ways of putting in the answer to this issue and the one that worked (even though it didn't work the first time) was:

**odds.each do |x|**
x*=2
print "#{x}"
end

Why it didn't work the first time I tried it, I don't know. I am not sure if spacing made a difference for the multiplication portion of the answer or not. From what I've learned so far, spacing in math in Ruby doesn't matter. Moving on and hope this helps anyone else who gets stuck on this lesson.