Any?


#1

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?


(Zhao Xin) #2

`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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users