From: tenten Date: 2012-09-20T15:15:53+09:00 Subject: Re: the behavior of iterator methods > I would look into Blocks, Procs, and Lambdas. The bit in the {} (or can > also be do end) is what's called a block. Procs and Lambdas are > basically storing Blocks for reuse. The |i| is the iterator variable. > Make sure to pay close attention to yields, injects, and other such > methods in both Blocks and Enumerables, it'll save you a load of time. > > (For instance: (1..5).inject(:*) will return 120, or 5! (factorial)) > > http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/ Thank you for the explanation. I appreciate any helps. > (1..5).inject(:*) will return 120, or 5! this is far beyond my reach at the moment, hahaha... Ruby clearly have some unique features I haven't know yet. By the way, the first time I had look at a ruby's syntax and some progurams using Procs or lambdas(maybe), it reminded me Curl language, which I used to use for a few years. http://www.curl.com/products/prod/language/ Do you know it? I think Curl isn't and won't be famous as Ruby, but it might be interesting for some Ruby programmers.