---
title: "prefix(while:)"
framework: swift-package-manager
role: symbol
role_heading: Instance Method
path: "swift-package-manager/documentation/packageplugin/pathlist/prefix(while:)"
---

# prefix(while:)

Inherited from Sequence.prefix(while:).

## Declaration

```swift
func prefix(while predicate: (Self.Element) throws -> Bool) rethrows -> [Self.Element]
```
