回答編集履歴
1
修正
test
CHANGED
@@ -3,3 +3,51 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
`random`に値を入れている部分はどのように記述されていますか?
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
`random`がなかったら以下の様に記述してみてください。
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```swift
|
16
|
+
|
17
|
+
@IBAction func tellFortunes(_ sender: Any) {
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
//乱数の発生
|
22
|
+
|
23
|
+
let random = Int(arc4random_uniform(2))
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
switch random {
|
28
|
+
|
29
|
+
case 0:
|
30
|
+
|
31
|
+
animalLabel.text = "????"
|
32
|
+
|
33
|
+
resultLabel.text = "大吉だワン!"
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
case 1:
|
38
|
+
|
39
|
+
animalLabel.text = "????"
|
40
|
+
|
41
|
+
resultLabel.text = "中吉だニャー!"
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
default:
|
46
|
+
|
47
|
+
break
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
```
|