From: Yukihiro Matsumoto Date: 2006-12-26T04:08:57+09:00 Subject: Re: Strange about Array#each_index Hi, In message "Re: Strange about Array#each_index" on Tue, 26 Dec 2006 03:51:19 +0900, Li Chen writes: |I query Ruby about Array#each_index and here are what Ruby returns: | |--------------------------------------------------- Array#each_index | array.each_index {|index| block } -> array |-------------------------------------------------------------------- | Same as +Array#each+, but passes the index of the element instead | of the element itself. |C:\>irb |irb(main):001:0> a = [ "a", "b", "c" ] |=> ["a", "b", "c"] |irb(main):002:0> a.each_index {|x| print x, " -- " } |0 -- 1 -- 2 -- => ["a", "b", "c"] |irb(main):003:0> each_index returns the receiver, and irb prints the return value. matz.