- 1
What's wrong?it could not process all right outputs.
fun main(args: Array<String>) { var age = readLine()!!.toInt() when { age<0 -> println("Invalid Age") age<=11 -> println("Child") age<=17 -> println("Teen") age<=64 -> println("Adult") else -> println("Senior") } }
3 Antworten
0
What do you mean by that? Can you share the code by linking the code bit?
0
This code works fine... 🤔
0
I don't know if it would make a difference but you could try:
var category = when {
age < 0 -> "Invalid Age"
age <= 11 ...
}
println(category)
see if that works.