Hard
repeat is the following standard library function:
inline fun repeat(times: Int, action: (Int) -> Unit)
Executes the given function action specified number of times.
A zero-based index of current iteration is passed as a parameter to action.
Looking at the following codes :
repeat(3) {
println("Hello")
}
repeat(3) { index ->
println("Hello with index $index")
}
repeat(3, index -> println("Hello with index $index") )
repeat(3, { println("Hello with index $it") })
Which of the following statements is true?
Author: W3D TeamStatus: PublishedQuestion passed 548 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about Kotlin