---
title: "subscript(_:)"
framework: swift
role: symbol
role_heading: Instance Subscript
path: "swift/keyvaluepairs/subscript(_:)"
---

# subscript(_:)

Accesses the element at the specified position.

## Declaration

```swift
subscript(position: KeyValuePairs<Key, Value>.Index) -> KeyValuePairs<Key, Value>.Element { get }
```

## Parameters

- `position`: The position of the element to access. position must be a valid index of the collection that is not equal to the endIndex property.

## Return Value

Return Value The key-value pair at position position.
