Write an implementation of a function named getLength that returns the length of a String, or -1 if the string is null.
Type system
String length
Report a typo
Sample Input 1:
KotlinSample Output 1:
6Write a program in Kotlin
fun getLength(input: String?): Int {
return 0
}
___
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.