Because the comparison function “==“ has the signature:
func ==(lhs: T?, rhs: T?) -> Bool
An optional parameter accepts non-optionals. In a sense non-optionals are
“promoted” to optionals when used for an optional parameter.
Rien.
> On 18 Oct 2016, at 10:58, Седых Александр via swift-users
>
> On 18 Oct 2016, at 09:58, Седых Александр via swift-users
> wrote:
>
> This code work:
>
> let one: Int? = 5
> let two = 5
> let result = one == two
>
> print(result)
>
> //print true
>
> Why we can access to Optional value without unwrap within comparison
> operations?
The 'one' valu
This code work:
let one: Int ? = 5
let two = 5
let result = one == two
print ( result )
//print true
Why we can access to Optional value without unwrap within comparison operations?
--
Седых Александр___
swift-users mailing list
swift-users@sw