There is a val line: String? value. Print its length or -1 if the line is null.
Nullable and non-nullable types
Line length
Report a typo
Write a program in Kotlin
fun main() {
val line: String? = readLine()
// write your code here. Do not change line above
println(line.length)// need a fix
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.