12.Loops and Iterators


#1



Why does it say I am incorrect? Been trying at it for 3 months. It says:

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, 2, 3, 4, 5]
odds.each do |odds|
odds *=2
print odds
end


#2

odds.each do |x|
    if x % 2 != 0
        puts x * 2
    end
end

Without a link to the exercise we have no way to check this against the instructions. Please post a link. Thank you.


#3

Hi, I struggled on this for a while also.
You have to make sure you are printing 'x' and not 'odds'.
Hope this clears it up.


#4

Thanks this helped :slight_smile:


#7