Write a function that takes a list of objects and returns the number of strings in the list. If the list item is not a string, it must be skipped. The function must use the is or !is operators to check the type of list items.
Type cast and smart cast
Writing a string counter
Report a typo
Write a program in Kotlin
fun countStrings(list: List<Any>): Int {
// make your code here
}
___
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.