1nil聚合运算符 nil coalescing operator
a ?? b ==>a!=nil ? a! : b
要求:
1a是一个可选类型
2b必须和a解包后类型一致
var userNickName:String?
//let outputName:String = userNickName != nil ? userNickName! : "Guest"
let outputName:String = userNickName ?? "Guest"
2区间运算符
闭区间 [a,b] a...b
前闭后开 [a,b) a..<b
3for-in循环
for index in 1...10
{
}
//index默认是一个常量值