Answers for "kotlin repeat function"

2

repeat kotlin

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.

// greets three times
repeat(3) {
    println("Hello")
}
Posted by: Guest on April-07-2021
0

kotlin repeat n times

repeat(repetitions) {
	// Do something
}
Posted by: Guest on May-23-2020

Browse Popular Code Answers by Language