[Vit-discuss] Top Ruby Projects algorithm?

John W. Long ng at johnwlong.com
Fri Aug 25 16:13:34 EDT 2006


zdennis 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}!"

Maybe a little too cryptic? Keep in mind this example might be the first 
example someone ever sees of Ruby.

--
John Long
http://wiseheartdesign.com


More information about the vit-discuss mailing list