示例工程 07-optionals

07-optionals/Diagnostics/CallOnOptional.swift

swift · 0.2 KB

// 故意编译失败:Optional 不能直接调用内部值的方法。
// 复现:swiftc Diagnostics/CallOnOptional.swift
let name: String? = nil
print(name.isEmpty)