---
title: popLast()
framework: Swift
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+, watchOS 27.0+]
path: swift/uniquearray/poplast()
---

# popLast()

Removes and returns the last element of the array, if there is one.

## Declaration

```swift
mutating func popLast() -> Element?
```

## Return Value

Return Value The last element of the array if the array is not empty; otherwise, nil.

## Discussion

Discussion note: O(1)
