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

# subscript(_:)

Accesses the element at specified position.

## Declaration

```swift
subscript(position: ClosedRange<Bound>.Index) -> Bound { get }
```

## Parameters

- `position`: The position of the element to access. position must be a valid index of the range, and must not equal the range’s end index.

## Overview

Overview You can subscript a collection with any valid index other than the collection’s end index. The end index refers to the position one past the last element of a collection, so it doesn’t correspond with an element.
