---
title: "finish(throwing:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/asyncthrowingstream/continuation/finish(throwing:)"
---

# finish(throwing:)

Resume the task awaiting the next iteration point by having it return nil, which signifies the end of the iteration.

## Declaration

```swift
func finish(throwing error: Failure? = nil)
```

## Parameters

- `error`: The error to throw, or nil, to finish normally.

## Discussion

Discussion Calling this function more than once has no effect. After calling finish, the stream enters a terminal state and doesn’t produce any additional elements.
