subscript(_:)
Accesses the element at specified position.
Declaration
subscript(position: Range<Bound>.Index) -> Range<Bound>.Element { get }Parameters
- position:
The position of the element to access.
positionmust be a valid index of the range, and must not equal the range’s end index.
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.