Code for .each is right, but 2 questions:


#1

my code is :

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

Add your code below!

odds.each { |odd|
odd *= 2
print " #{odd}" }

  1. without the newline character, it puts all the numbers on same line? i thought puts worked like this?
    1a. with or without \n , it complains about my output. ??
  2. why does it always (in this and other exercises) print out the array at the end ??
    see:
    1112131415[1, 2, 3, 4, 5]

#2

A1: Yes, puts puts each on a new line, but print prints them all to the same line.
A2: Because Ruby returns the last thing it does.