method
each_index
each_index()
public
Same as Array#each, but passes the index of the element instead of the element itself.
a = [ "a", "b", "c" ] a.each_index {|x| print x, " -- " }
produces:
0 -- 1 -- 2 --
each_index()
public
Same as Array#each, but passes the index of the element instead of the element itself.
a = [ "a", "b", "c" ] a.each_index {|x| print x, " -- " }
produces:
0 -- 1 -- 2 --