On Wed, Mar 26, 2008 at 3:19 PM, Shendelzare Silkwood <zerruellx / yahoo.com> wrote: > I want to add together numbers in an array with the inject command. I > want only the even numbers using only inject. > > So, something like [1,2,3,4].inject.....but don't know what to do so > help! > > Second, I need to reverse an array using only the inject command. So, > something like above with the result [4,3,2,1] Hmm making your homework here? inject([]){ |a,e| [e]+a } that of course is a st****d way to reverse an array. HTH Robert > > I'm confused...help! > -- > Posted via http://www.ruby-forum.com/. > > -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein