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

17th Dec 2022, 5:07 PM
gafer alip
gafer alip - avatar
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") } }
17th Dec 2022, 6:41 PM
Sadaam Linux
Sadaam Linux - avatar
+ 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") }
18th Dec 2022, 8:33 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Is it printl*i*n or println?
17th Dec 2022, 5:38 PM
Ausgrindtube
Ausgrindtube - avatar
0
Println
17th Dec 2022, 5:58 PM
gafer alip
gafer alip - avatar