From: Robert Klemme Date: 2008-02-05T05:44:58+09:00 Subject: Re: ruby wish-list On 04.02.2008 20:52, Roger Pack wrote: >> On Thu, Jan 31, 2008 at 09:06:05AM +0900, Roger Pack wrote: > > Another wish--I wish that the block style stuff was invertable. > programs.each_with_index {|program, index|...} > > would work with > > for program, index in programs.each_with_index {} Like $ irb -r enumerator irb(main):001:0> programs = %w{foo bar} => ["foo", "bar"] irb(main):002:0> for p,i in programs.to_enum(:each_with_index) irb(main):003:1> puts p, i irb(main):004:1> end foo 0 bar 1 => ["foo", "bar"] ? > Then you wouldn't have to remember syntax again, ever :) I don't see the difference - I mean, you have to remember both ways, don't you? Cheers robert