回答編集履歴
1
ruby
test
CHANGED
@@ -17,3 +17,25 @@
|
|
17
17
|
```
|
18
18
|
|
19
19
|
考えてみました。
|
20
|
+
|
21
|
+
要素数を数える場合は
|
22
|
+
|
23
|
+
```Ruby
|
24
|
+
|
25
|
+
# encoding: utf-8
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
text = ["was going to school", "is really kind person", "can promise it forever"]
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
text1, text2, text3 = text.map { |e| e.split(' ').size }
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
p text1, text2, text3
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
こんな感じで。
|