質問編集履歴
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -78,6 +78,34 @@
|
|
78
78
|
|
79
79
|
```
|
80
80
|
|
81
|
+
追記 単純化させましたが、以下のコードを叩いて
|
82
|
+
|
83
|
+
出力結果のIndex is 0, list is ["a", "b", "c", "d", "e", "f"]を
|
84
|
+
|
85
|
+
Index is 0, list is ["a"]
|
86
|
+
|
87
|
+
Index is 1, list is ["b"]
|
88
|
+
|
89
|
+
Index is 2, list is ["c"]
|
90
|
+
|
91
|
+
のような結果になる書き方を教えて頂きたいです。
|
92
|
+
|
93
|
+
```Ruby
|
94
|
+
|
95
|
+
list =["a","b","c","d","e","f"]
|
96
|
+
|
97
|
+
hash = {names: [list]}
|
98
|
+
|
99
|
+
hash[:names].each.with_index do |value, idx|
|
100
|
+
|
101
|
+
puts "Index is #{idx}, list is #{value}"
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
```
|
108
|
+
|
81
109
|
### 補足情報(FW/ツールのバージョンなど)
|
82
110
|
|
83
111
|
ruby 2.5.3p105
|