diff options
author | Cory Forsyth <cory.forsyth@gmail.com> | 2019-12-02 16:57:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-02 16:57:13 -0500 |
commit | 88795664c5ff1980f41bfa39f853cef12f60e92e (patch) | |
tree | eef2be03c6913f25f86eaf7544567ccaa73207b5 /swift.html.markdown | |
parent | 06e05c4ce3e23ee0030c820af09eeadac07b1baf (diff) |
Return value of `findIndex` is `Optional<Int>`
Diffstat (limited to 'swift.html.markdown')
-rw-r--r-- | swift.html.markdown | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/swift.html.markdown b/swift.html.markdown index 1f9fe897..8c1a7755 100644 --- a/swift.html.markdown +++ b/swift.html.markdown @@ -904,7 +904,7 @@ func findIndex<T: Equatable>(array: [T], valueToFind: T) -> Int? { } return nil } -findIndex(array: [1, 2, 3, 4], valueToFind: 3) // 2 +findIndex(array: [1, 2, 3, 4], valueToFind: 3) // Optional(2) // You can extend types with generics as well extension Array where Array.Element == Int { |