hmmm...

don't really like the long name. alias iterate ?

but then i wonder, is it possible to define iterators that recognize
the number of parameters and act accordingly?

# just the object
arr.each  { |x|
  ...
}

# the object with index
arr.each |x, i| {
 ...
}

~transami


On Wed, 2002-07-10 at 16:34, David Alan Black wrote:
> Hello --
> 
> On Thu, 11 Jul 2002, Tom Sawyer wrote:
> 
> > 5. an automatic index counter - i'm doing an arr.each but i also need a
> > count too.
> 
> Array#each_with_index will do the trick.
> 
> 
> David
> 
> -- 
> David Alan Black
> home: dblack / candle.superlink.net
> work: blackdav / shu.edu
> Web:  http://pirate.shu.edu/~blackdav
> 
> 
-- 
~transami

"They that can give up essential liberty to obtain a little
 temporary safety deserve neither liberty nor safety."
	-- Benjamin Franklin