William Morgan wrote:
> Excerpts from daz's mail of  8 Jul 2005 (EDT):
> >
> >  h.each            {|ek, ev|  p [ek  , ev       ]}
> >  h.each_with_index {|e, idx|  p [e[0], e[1], idx]}
> > #      ^_________^      ^_^       ^_^  ^^_^  ^_^
> > #           A            B         C   D C    E
> >
>
> Minor point, but you can also do
>
>    h.each_with_index { |(ek, ev), idx| p [ek, ev, idx] }
>
> which solves C and D (though I guess introduces an "F").
>
> William
>

A very strong point; one that I hadn't considered.
If the parens are left in, it's OK.

  h.each_with_index { |(ek, ev), idx| p [ek, ev, idx] }
  h.each            { |(ek, ev)     | p [ek, ev     ] }

Dang, there's always a way with Ruby ;-)


daz
-- 
"Doctor, I'm cured." - A. Patient