From: Chandramouli Parasuraman on
Great, now I understand. Works fine now with both Array.new(1000) {|i|
i+1} and the inject.

Thanks everyone.

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

From: Thomas Volkmar Worm on
(1..1000).select{|n| n % 3 == 0 or n % 5 == 0}.inject{|sum,n| sum + n }
First  |  Prev  | 
Pages: 1 2
Prev: Something I expected to work, but didn't!
Next: Scope