Skip to content

Commit 08e424e

Browse files
committed
add doc on suffix method
1 parent 813ea79 commit 08e424e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/Algorithms/Suffix.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
//===----------------------------------------------------------------------===//
1515

1616
extension BidirectionalCollection {
17+
/// Returns a subsequence containing the elements from the end until `predicate`
18+
/// returns `false` and skipping the remaining elements.
19+
///
20+
/// - Parameter predicate: A closure that takes an element of the
21+
/// sequence as its argument and returns `true` if the element should
22+
/// be included or `false` if it should be excluded. Once the predicate
23+
/// returns `false` it will not be called again.
24+
///
25+
/// - Complexity: O(*n*), where *n* is the length of the collection.
1726
public func suffix(
1827
while predicate: (Element) throws -> Bool
1928
) rethrows -> SubSequence {

0 commit comments

Comments
 (0)