---
title: first
framework: swift
role: symbol
role_heading: Instance Property
path: swift/dictionary/first
---

# first

The first element of the collection.

## Declaration

```swift
var first: Self.Element? { get }
```

## Discussion

Discussion If the collection is empty, the value of this property is nil. let numbers = [10, 20, 30, 40, 50] if let firstNumber = numbers.first {     print(firstNumber) } // Prints "10"

## See Also

### Accessing Keys and Values

- [subscript(_:)](swift/dictionary/subscript(_:)-8rfql.md)
- [subscript(_:default:)](swift/dictionary/subscript(_:default:).md)
- [index(forKey:)](swift/dictionary/index(forkey:).md)
- [subscript(_:)](swift/dictionary/subscript(_:)-4bhoo.md)
- [keys](swift/dictionary/keys-swift.property.md)
- [values](swift/dictionary/values-swift.property.md)
- [randomElement()](swift/dictionary/randomelement().md)
- [randomElement(using:)](swift/dictionary/randomelement(using:).md)
