Why does Swift's optional binding succeed with 'nil' in certain cases?

后端 未结 2 470
梦毁少年i
梦毁少年i 2020-12-20 02:08

Apple\'s Swift language documentation says that optional binding (a.k.a. if let) will \"check for a value inside an optional\" and \"extra

2条回答
  •  隐瞒了意图╮
    2020-12-20 02:39

    You assigned an optional Int to an optional Int. The assignment did succeed. It will always succeed, whether the optional Int contained an Int or not.

提交回复
热议问题