guard声明的对象 初始化对象必须为可选类(?)
//时间:
var MentFrom:String? =“” (optional类型)
guard let str = self.MentFrom else{return}
//实例:
func setxx(k:NSInteger?){
if let w = k, k! >0{
print(w)
}
guard let j = k else{
return
}
print(j)
guard let xx = k else { return }
print(xx)
}
网友评论