回答編集履歴

2

修正

2016/11/04 01:14

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -1,4 +1,4 @@
1
- `inout`で渡すとやりたい事ができると思います。
1
+ 以下の様にとやりたい事ができると思います。
2
2
 
3
3
 
4
4
 

1

修正

2016/11/04 01:14

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- func append(type: String, array: inout NSMutableArray) -> Bool {
13
+ func append(type: String, array: NSMutableArray) -> Bool {
14
14
 
15
15
  let todo = "test"
16
16
 
@@ -44,19 +44,19 @@
44
44
 
45
45
 
46
46
 
47
- let b1 = append(type: "hoge", array: &self.hoge)
47
+ let b1 = append(type: "hoge", array: self.hoge)
48
48
 
49
49
  //=> true
50
50
 
51
51
 
52
52
 
53
- let b2 = append(type: "fuga", array: &self.fuga)
53
+ let b2 = append(type: "fuga", array: self.fuga)
54
54
 
55
55
  //=> true
56
56
 
57
57
 
58
58
 
59
- let b3 = append(type: "piyo", array: &self.fuga)
59
+ let b3 = append(type: "piyo", array: self.fuga)
60
60
 
61
61
  //=> false
62
62