---
title: "contains(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/throwingtaskgroup/contains(_:)"
---

# contains(_:)

Returns a Boolean value that indicates whether the asynchronous sequence contains the given element.

## Declaration

```swift
func contains(_ search: Self.Element) async rethrows -> Bool
```

## Parameters

- `search`: The element to find in the asynchronous sequence.

## Return Value

Return Value true if the method found the element in the asynchronous sequence; otherwise, false.

## Discussion

Discussion In this example, an asynchronous sequence called Counter produces Int values from 1 to 10. The contains(_:) method checks to see whether the sequence produces the value 5: let containsFive = await Counter(howHigh: 10)     .contains(5) print(containsFive) // Prints "true"

## See Also

### Accessing an Asynchronous Sequence of Results

- [makeAsyncIterator()](swift/throwingtaskgroup/makeasynciterator().md)
- [allSatisfy(_:)](swift/throwingtaskgroup/allsatisfy(_:).md)
- [compactMap(_:)](swift/throwingtaskgroup/compactmap(_:)-944nh.md)
- [compactMap(_:)](swift/throwingtaskgroup/compactmap(_:)-7mgi5.md)
- [contains(where:)](swift/throwingtaskgroup/contains(where:).md)
- [drop(while:)](swift/throwingtaskgroup/drop(while:).md)
- [dropFirst(_:)](swift/throwingtaskgroup/dropfirst(_:).md)
- [filter(_:)](swift/throwingtaskgroup/filter(_:).md)
- [first(where:)](swift/throwingtaskgroup/first(where:).md)
- [map(_:)](swift/throwingtaskgroup/map(_:)-58nrv.md)
- [map(_:)](swift/throwingtaskgroup/map(_:)-4a4ju.md)
- [max()](swift/throwingtaskgroup/max().md)
- [max(by:)](swift/throwingtaskgroup/max(by:).md)
- [min()](swift/throwingtaskgroup/min().md)
- [min(by:)](swift/throwingtaskgroup/min(by:).md)
