回答編集履歴
1
reduce
test
CHANGED
@@ -17,3 +17,17 @@
|
|
17
17
|
return (0..<length).map { print($0); return getRandomCharacter() }.joined()
|
18
18
|
|
19
19
|
```
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
【追記】
|
24
|
+
|
25
|
+
後れを取ってしまったのでreduceいっときます!
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```swift
|
30
|
+
|
31
|
+
return (0..<length).reduce("") { (result, _) in result + getRandomCharacter() }
|
32
|
+
|
33
|
+
```
|