ary = Array.new ary[7] = true i = 0 while i < ary.length v = ary[i] puts 'while ... end: ary[' + i.to_s + '] = ' + v.to_s i += 1 end ary.each_with_index do |v, i| puts 'each_with_index:ary[' + i.to_s + '] = ' + v.to_s end p ary