swift ?? 空合运算符

2019-11-20  本文已影响0人  舟_e9ce

let name = username? ?? "xiaoxiao"

用在可选值后面, username 如果为空那么默认值为 “xiaoxiao”

上一篇 下一篇

猜你喜欢

热点阅读