forEachWhile method

void forEachWhile(
  1. bool action(
    1. E element
    )
)

Takes an action for each element as long as desired.

Calls action for each element. Stops iteration if action returns false.

Implementation

void forEachWhile(bool Function(E element) action) {
  for (var index = 0; index < length; index++) {
    if (!action(this[index])) break;
  }
}