applyEachIndexed

inline fun <T, E> T.applyEachIndexed(elements: Iterable<E>, block: T.(index: Int, e: E) -> Unit): T(source)
inline fun <T, E> T.applyEachIndexed(elements: Array<E>, block: T.(index: Int, e: E) -> Unit): T(source)

Applies the given block to each element in the iterable and returns the receiver object.

Return

The receiver object after applying the block to each element.

Parameters

elements

The iterable collection of elements to apply the block to.

block

The block of code to apply to each element.