/* * call-seq: * array.each_index {|index| block } -> array * * Same as <code>Array#each</code>, 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 -- */ static VALUE rb_ary_each_index(ary) VALUE ary; { long i; for (i=0; i<RARRAY(ary)->len; i++) { rb_yield(LONG2NUM(i)); } return ary; }