Returns the last index where the specified value appears in the collection.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 10.0+
An element to search for in the collection.
The last index where
element is found. If
element is not found in the collection, this method returns
last to find the position of the last instance of a particular element in a collection, you can use it to access the element by subscripting. This example shows how you can modify one of the names in an array of students.
Complexity: O(n), where n is the length of the collection.