ループ中のインデックスと値
Top > Ruby [2.2.2] > each_with_index
test = ["acha","porute","piipo"] test.each_with_index do |value, index| print index, "-", value, "\n" end # 0-acha # 1-porute # 2-piipo