Why are my numbers not multiplying?



Oops, try again. It looks like your iterator didn't print out double the value of each item of the odds array. Make sure to multiply each item by 2.

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

# Add your code below!
odds.each do |i|
i * 2
print i


i * 2 does not change the value of i, it simply returns new value. If you want to change value of i you have to assign returned value to the variable:

i = i * 2


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