1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| fun main (){
val luckyNum = 4
val yourNum = (1..6).random()
val result = when(yourNum){
luckyNum -> "You get the lucky num ${luckyNum}"
1 -> "Sorry, you get 1"
2 -> "Sorry, you get 2"
3 -> "Sorry, you get 3"
4 -> "Sorry, you get 4"
5 -> "Sorry, you get 5"
6 -> "Sorry, you get 6"
else -> "Sorry, you get a number out of 1..6"
}
println(result)
}
|