Accesses the element at the specified position.
Required. Default implementation provided.
- Xcode 8.0+
- Swift Standard Library
The position of the element to access.
positionmust be a valid index of the collection that is not equal to the
The following example accesses an element of an array through its subscript to print its value:
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.