What's wrong?it could not process all right outputs. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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") } }

27th May 2022, 9:46 AM
atharv bhati
3 Answers
0
What do you mean by that? Can you share the code by linking the code bit?
27th May 2022, 10:16 AM
Justice
Justice - avatar
0
This code works fine... 🤔
27th May 2022, 10:34 AM
Solo
Solo - avatar
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.
27th May 2022, 10:44 AM
Ausgrindtube
Ausgrindtube - avatar