Instance Method

prefix(while:)

Returns a lazy sequence of the initial consecutive elements that satisfy predicate.

Declaration

func prefix(while predicate: @escaping (Base.Element) -> Bool) -> LazyPrefixWhileSequence<LazyDropWhileSequence<Base>>

Parameters

predicate

A closure that takes an element of the sequence as its argument and returns true if the element should be included or false otherwise. Once predicate returns false it will not be called again.