测试代码时候运行结果不解
你好,运行如下代码:
var optionalname:String?="John Applesed"
optionalname==nil
var greeting="Hello"
if let name=optionalname{
greeting="Hello,\(optionalname)"
}else{
"no result"
}
if条件optionnalname被赋值nil,其条件应该为false,输出no result,但playground显示
Hello,Optional("John Applesed")
实在不解,怎么回事