#author("2021-09-06T05:41:06+00:00","default:src128","src128") &tag(Ruby/制御構造); *目次 [#o32a8da7] #contents *関連ページ [#u5a3468b] *参考情報 [#m4cdc4c7] *ループ [#g860da28] **インデックスを使ってループしたい [#m41a3981] -timesを使う a = ['a', 'b', 'c'] a.size.times do |i| puts i end => 0, 1, 2 -uptoを使う a = ['a', 'b', 'c'] 0.upto(a.size - 1) do |i| puts i end => 0, 1, 2 -範囲オブジェクトを使う a = ['a', 'b', 'c'] (0...a.size).each do |i| puts i end => 0, 1, 2