kotlin-times / kt.times / kotlin.Long / times

times

inline operator infix fun Long.times(action: (Long) -> Unit): Unit

Allows to repeat an action N times, where N is a Long value on which this method is invoked. Since this method is marked as inline, there should be no runtime overhead of using this method over simple range iteration (or its Java for-loop equivalent, for that matter).

Parameters

action - its invocations amount will be equal to this Long value. If the value is 0 or negative, this action will not be invoked. It consumes current iteration index, starting from 0 and ending with (value-1).