[swift-users] Any?

Zhao Xin owenzx at gmail.com
Tue Sep 27 06:11:03 CDT 2016


`Any` is different from `Any?`.  For example, if `Any` is an `Optional<T>`,
`Any?` is an `Optional<Optional<T>>`.

I
​n you code, since ​`dictionary` subscripts may `return nil`, the `?` is
for that. The `Any` is for the type of the `none-nil return value`.


Zhaoxin

On Tue, Sep 27, 2016 at 6:43 PM, Седых Александр via swift-users <
swift-users at swift.org> wrote:

> Hello. I have little question about type Any on screenshot.
>
> Why we need the type Optional Any????
> In book we read, that Any may be any type. And any type is not include
> optionals in self?
>
>
>
>
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160927/ed78a978/attachment.html>


More information about the swift-users mailing list