# skipWhile method

1. @override

Iterable<E> skipWhile(

1. bool test(
   1. E value
   )

)
override

Creates an `Iterable` that skips leading elements while `test` is satisfied.

The filtering happens lazily. Every new Iterator of the returned iterable iterates over all elements of `this`.

The returned iterable provides elements by iterating this iterable, but skipping over all initial elements where `test(element)` returns true. If all elements satisfy `test` the resulting iterable is empty, otherwise it iterates the remaining elements in their original order, starting with the first element for which `test(element)` returns `false`.

Example:

    final numbers = <int>[1, 2, 3, 5, 6, 7];
    var result = numbers.skipWhile((x) => x < 5); // (5, 6, 7)
    result = numbers.skipWhile((x) => x != 3); // (3, 5, 6, 7)
    result = numbers.skipWhile((x) => x != 4); // ()
    result = numbers.skipWhile((x) => x.isOdd); // (2, 3, 5, 6, 7)

## Implementation

    @override
    Iterable<E> skipWhile(bool Function(E value) test) sync* {
      bool skipping = true;
      for (final element in this) {
        if (skipping && test(element)) {
          // Still skipping
        } else {
          skipping = false;
          yield element;
        }
      }
    }