From: "Jan E." Date: 2012-09-28T20:55:28+09:00 Subject: Re: Suma de elementos de un array, problema Hi, This isn't the spanish Ruby group, so use English, please. The error message is telling you that you cannot use "return" in this context (you're not in a method). I'm not even sure what you want. Return from the "each" method? Jump to the next element? As far as I can tell, you don't need any of this, so just delete the "return sumador". In fact, your code is quite complicated for this simple task. Do you really need a method just to add two numbers? I'd simply do this: vect = [1, 2, 3, 4, 5] sum = 0 vect.each do |number| sum += number end That's it. Ruby also has a method for this kind of operation: Enumerable#inject http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-inject So you could boil it down to: vect = [1, 2, 3, 4, 5] vect.reduce :+ -- Posted via http://www.ruby-forum.com/.