[swift-users] array.first vs. array[0]
David Turnbull
dturnbull at gmail.com
Sat Jan 16 17:07:18 CST 2016
On Sat, Jan 16, 2016 at 2:46 PM, Adriano Ferreira via swift-users <
swift-users at swift.org> wrote:
> Isn’t the subscript supposed to return an optional as well?
>
Not arrays. They stop your program when out of bounds.
> Why unwrapping isn't required when `pivot` is used within the `filter`
> call?
>
Type inference on the closure. $0 is made optional as part of the call.
-david
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160116/1c873511/attachment.html>
More information about the swift-users
mailing list