---
title: finishExecution()
framework: playgroundsupport
role: symbol
role_heading: Instance Method
path: playgroundsupport/playgroundpage/1964505-finishexecution
---

# finishExecution()

Terminates execution of the current playground page.

## Declaration

```swift
final func finishExecution() -> Never
```

```swift
func finishExecution() -> Never
```

## Discussion

Discussion This function immediately terminates any code running in the playground. Call this function when you've set needsIndefiniteExecution to true to indicate that the indefinite period of code execution has ended.

## See Also

### Configuring Execution

- [executionMode](playgroundsupport/playgroundpage/3029561-executionmode.md)
- [PlaygroundPage.ExecutionMode](playgroundsupport/playgroundpage/executionmode.md)
- [needsIndefiniteExecution](playgroundsupport/playgroundpage/1964501-needsindefiniteexecution.md)
