How to use count in Kotlin or how to count in Kotlin?

All QuestionsCategory: KotlinHow to use count in Kotlin or how to count in Kotlin?
chetan shidling asked 4 years ago

I need short information.

1 Answers
chetan shidling answered 4 years ago

By using the count() keyword. Let’s see one example.
 
Code:
 
fun main(args : Array<String>){
var nums = 1 until 10

for(a in nums.reversed())
{
println(a)
}

println(“Couts is ” +nums.count())
}
 
Output:
 
9
8
7
6
5
4
3
2
1
Couts is 9