forEach

inline fun <T> Iterable<T>.forEach(action: (T) -> Unit)(source)

Calls action for each element in iteration order.

Calls the action once per element, including null elements. An empty iterable invokes no callbacks. This function does not create a result collection. Exceptions from iteration or the callback propagate to the caller. The inline callback supports non-local returns.

Receiver

elements to visit in their iteration order.

Parameters

action

action receiving the current element.