回答編集履歴
2
s
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
```swift
|
8
8
|
|
9
|
-
//
|
9
|
+
// それぞれの文字列をIntに変換、変換できた場合ののみ処理を行う
|
10
10
|
|
11
11
|
if let intTouchX = Int(touchX), let intMust1 = Int(must1) {
|
12
12
|
|
1
s
test
CHANGED
@@ -6,11 +6,23 @@
|
|
6
6
|
|
7
7
|
```swift
|
8
8
|
|
9
|
+
// 文字列のそれぞれをIntに変換、変換できた場合ののみ処理を行う
|
10
|
+
|
9
11
|
if let intTouchX = Int(touchX), let intMust1 = Int(must1) {
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
// Intどうしの足し算
|
10
16
|
|
11
17
|
var number = must1 + touchX
|
12
18
|
|
19
|
+
|
20
|
+
|
21
|
+
// IntをStringに変換
|
22
|
+
|
13
23
|
must1 = String(number)
|
24
|
+
|
25
|
+
// 文字列をラベルに表示する
|
14
26
|
|
15
27
|
mustLabel.text = must1
|
16
28
|
|