prefix(while:)
Returns a lazy sequence of the initial consecutive elements that satisfy predicate.
Declaration
func prefix(while predicate: @escaping (Self.Elements.Element) -> Bool) -> LazyPrefixWhileSequence<Self.Elements>Parameters
- predicate:
A closure that takes an element of the sequence as its argument and returns
trueif the element should be included orfalseotherwise. Oncepredicatereturnsfalseit will not be called again.