[Vit-discuss] Top Ruby Projects algorithm?

zdennis zdennis at mktec.com
Fri Aug 25 16:22:25 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Todd Willey wrote:
> On 8/25/06, zdennis <zdennis at mktec.com> wrote:
> The sum example with inject IMO is great...
> 
>   numbers = 1, 3, 5, 7, 9, 11, 13, 15, 17
>   sum = numbers.inject( 0 ){ |sum,n| sum+=n }
>   puts "The sum is #{sum}!"
> 
>> You don't need assignment when doing inject.
>>  so sum + n is sufficient.

You are correct. Thanks Todd,

Zach
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE71wBMyx0fW1d8G0RAuUBAJ4noNvQj6lqGMSSM0bOPHhuw3NuLgCfblqD
r8rFwHYQ0LCxzAkZ+8mLzLE=
=rBG3
-----END PGP SIGNATURE-----


More information about the vit-discuss mailing list