0
What is the error in this code
fun main(args: Array<String>) { var age = readLine()!!.toInt() when{ age <- 0 ->printlin("Inavlid age") age <= 11 ->printlin("Child") age <= 17 ->printlin("Teen") age <= 64 ->printlin("Adult"), else -> printlin("Senior") } }please help me or give me the solution for this issue
4 Réponses
+ 3
fun main(args: Array<String>) {
var age = readLine()!!.toInt()
when{
age < 0 ->printlin("Inavlid age")
age <= 11 ->printlin("Child")
age <= 17 ->printlin("Teen")
age <= 64 ->printlin("Adult"),
else -> printlin("Senior")
}
}
+ 3
You have several errors. Look closely.
I've made a smaller code, hopefully it sends you down the right path.
when{
age >= 0 -> println("a number")
else -> println("Invalid age")
}
+ 1
Is it printl*i*n or println?
0
Println