From: Simon Strandgaard Date: 2006-01-03T07:06:49+09:00 Subject: Re: Implicit block parameter? On 1/2/06, Simon Strandgaard wrote: > On 1/2/06, Ross Bamford wrote: > > On Mon, 02 Jan 2006 20:20:30 -0000, I wrote: > > > > > Before I used Ruby, I used Groovy. In some ways they are (well, were > > > anyway) quite similar, and one feature that I found cool in Groovy that > > > I often miss in Ruby is the implicit (/default/whatever?) block > > > parameter, 'it': > > > > > > [1,2,3].each { puts it } > or how about? module Kernel def it $i end end class Array alias :each1 :each def each(&b) each1{|i| b.call($i = i) } end end [1, 2, 3].each{ puts it } # 1 2 3 -- Simon Strandgaard