---
title: dropLast()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/indexpath/droplast()
---

# dropLast()

Return a new index path containing all but the last element.

## Declaration

```swift
func dropLast() -> IndexPath
```

## See Also

### Selecting Nodes

- [append(_:)](foundation/indexpath/append(_:)-6dxrh.md)
- [append(_:)](foundation/indexpath/append(_:)-6vsd5.md)
- [append(_:)](foundation/indexpath/append(_:)-7qv6f.md)
- [appending(_:)](foundation/indexpath/appending(_:)-93eco.md)
- [appending(_:)](foundation/indexpath/appending(_:)-53tcl.md)
- [appending(_:)](foundation/indexpath/appending(_:)-174v0.md)
- [compare(_:)](foundation/indexpath/compare(_:).md)
- [index(after:)](foundation/indexpath/index(after:).md)
- [index(before:)](foundation/indexpath/index(before:).md)
- [makeIterator()](foundation/indexpath/makeiterator().md)
