回答編集履歴

1

追記

2015/12/15 21:20

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -31,3 +31,31 @@
31
31
  }
32
32
 
33
33
  ```
34
+
35
+
36
+
37
+ 同じくswift2.0ですが、、、
38
+
39
+
40
+
41
+ if( resultA != nil && resultB != nil )
42
+
43
+ という判定ではresultA,resultBともにnilの判定をしているだけでアンラップされていません、
44
+
45
+ 以下の様に書くとアンラップして『!』の無い安全なコードになります。
46
+
47
+
48
+
49
+ ```swift
50
+
51
+ if let resultA = resultA, resultB = resultB {
52
+
53
+ resultLabel.text = "答えは" + String(resultA * resultB)
54
+
55
+ }else{
56
+
57
+ resultLabel.text = "入力値が不正です"
58
+
59
+ }
60
+
61
+ ```