nice to meet you all.. I have been studying Kotlin for a several days, I would like to ask about Kotlin. When I tried to run it, its says ‘if’ must have both main and ‘else’ branches if used as an expression. I have the score variable and the result variable as shown below. What’ve could go wrong about my code below??
var score = 76
var score_letter = if (0 < score < 50 ) {
println("nilai $score memiliki nilai huruf D")
} else if (51 < score =< 60) {
println("nilai $score memiliki nilai huruf C+")
} else if (61 < score =< 70) {
println("nilai $score memiliki nilai huruf C")
} else if (71 < score =< 85) {
println("nilai $score memiliki nilai huruf B")
} else if (86 < score =< 100) {
println("nilai $score memiliki nilai huruf A")
}
println(score_letter)
Thank you.