From: matz@... (Yukihiro Matsumoto) Date: 1998-06-16T12:11:52+09:00 Subject: [ruby-list:8368] Re: counter of iterator まつもと ゆきひろです In message "[ruby-list:8362] counter of iterator" on 98/06/16, 助田 雅紀 writes: |助田です。 | |質問です。 |イテレータの中で何回ブロックが実行されたか知るカウンター変数みたい |なものってありますか? 1.1b7以降にはeach_with_indexってのがあります. array = ['a', 'b', 'c'] array.each_with_index do |item, idx| puts idx + " " + item end って感じで使えます. まつもと ゆきひろ /:|)