ary.each_index { |index| block } â ary
ary.each_index â Enumerator
ary.each_index â Enumerator
Instance Public methods
Same as #each, but passes the
index
of the element instead of the element itself.
An Enumerator is returned if no block is given.
a = [ "a", "b", "c" ] a.each_index {|x| print x, " -- " }
produces:
0 -- 1 -- 2 --
Please login to continue.