title: Passing an array as an argument in Ruby
body: <p>I've been learning Ruby and am attempting a problem that takes an array of numbers as input, squares the integers at even positions in the array and then sums the squared integers + the integers at odd positions in the array. (1,2,3,4,5 should return 29). I got it to run, however, I'm having trouble passing in the numbers as an argument. Everytime I attempt to define the method and pass in the array when calling the method, I get an error.</p>
  
  <p><strong>Basically, I want the method to be:</strong> </p>
  
  <p><code>def alternate_sq_sum([])</code> and the ability to pass any array of numbers by calling the method. </p>
  
  <pre><code>Ex. alternate_sq_sum([1,4,63,2,1]).
  </code></pre>
  
  <p><strong>Here's my current code:</strong></p>
  
  <pre><code>arr = [1,2,3,4,5]
  even = arr.select.each_with_index { |str,i| i.even? }
  odd = arr.select.each_with_index {|str,i| i.odd? }
  
  even_sum = 0
  even.map do |n|
    even_sum +=n
  end
  
  odd_sum = 0
  odd.map do |n|
    n*=n
    odd_sum+=n
  end
  
  print even_sum + odd_sum
  </code></pre>