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 558 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!
3
Write a Kotlin program that evaluates an arithmetic expression.4
Kotlin: Compile the following code and see the error.7
How to flatten a list of lists in Kotlin5
Write a function that returns the maximum of two integers in Kotlin2
Print the value of a nullable string in Kotlin2
How to add a new element to a list of Kotlin data class2
Concatenate two strings in Kotlin