def main(aArray)
  sum = 0
  if a.count > 0
    a.each {|i| sum += i }
    return sum / a.count.to_f
  end
  0
end

a = [1,2,3,4]

puts main(a)

-- 
Posted via http://www.ruby-forum.com/.