fun example(score : Int){
when(){
0 -> println("this is 0")
1 -> println("this is 1")
2,3 -> println("this is 2 or 3")
else -> println("I dont't know")
}
}
2,3으로 지정할 수 있다
var b : Int = when(score){
1-> 1
2-> 2
else -> 3
}
when(){
in 90..100 -> println("You are genius")
in 10..80 -> println("not bad")
else -> println("okay")
}
else를 꼭 써줘야함
참조 : 유투브 강의 Code with Joyce