回答編集履歴

1

編集

2019/12/09 02:06

投稿

TakuyaAso
TakuyaAso

スコア1361

test CHANGED
@@ -6,7 +6,53 @@
6
6
 
7
7
  ```
8
8
 
9
+ @IBAction func seg1(_ sender: UISegmentedControl) {
10
+
11
+ switch sender.selectedSegmentIndex {
12
+
13
+ case 0:
14
+
15
+ seg1number = 1
16
+
17
+ case 1:
18
+
19
+ seg1number = 2
20
+
21
+ default : return
22
+
23
+ }
24
+
9
- func sum() {
25
+ self.sum()
26
+
27
+ }
28
+
29
+
30
+
31
+ @IBAction func seg2(_ sender: UISegmentedControl) {
32
+
33
+ switch sender.selectedSegmentIndex {
34
+
35
+ case 0:
36
+
37
+ seg2number = 0
38
+
39
+ case 1:
40
+
41
+ seg2number = 10
42
+
43
+ default:
44
+
45
+ return
46
+
47
+ }
48
+
49
+ self.sum()
50
+
51
+ }
52
+
53
+
54
+
55
+ func sum() { // 関数名はもっと適切な命名を
10
56
 
11
57
  sum = seg1number + seg2number
12
58