title: How to multiply the elements of an array using array#each?
body: <p>I am trying to write a method which takes as its input an array of integers and returns their product. For example:</p>
  
  <pre><code>product([1,2,3])    # returns 6
  </code></pre>
  
  <p>I need to do this using <code>Array#each</code> and not the inject method. This is what I have come up with, but it seems to be incorrect:</p>
  
  <pre><code>def product(array)
    final = 0.0
    array.each do |i|
      final *= i
    end
    return final
  end
  </code></pre>
  
  <p>Also, how could I modify this method to return the product of all the odd integers in the array, such that</p>
  
  <pre><code>product([1,2,3])     # returns 3, because 2 is even
  
  product([0,-1,-10])  # returns -1, because 0 and -10 are even
  </code></pre>