repeat While
suspend fun <R> repeatWhile(maxAttempts: Long = 10, delay: Duration = 500.milliseconds, predicate: (R) -> Boolean, block: suspend () -> R): List<R>(source)
Repeats an operation while a condition is true, collecting all results.
Return
List of all results collected
Parameters
max Attempts
The maximum number of attempts (defaults to 10)
delay
The delay between attempts (defaults to 500 milliseconds)
predicate
Predicate to test the result; returns true to continue repeating
block
The suspend operation to repeat
Type Parameters
R
The return type of the suspend operation