Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在下面的代码中,我希望 Xcode 不接受,因为我在代码主体中使用字符串作为返回值,而不是元组。但是由于某种原因,Xcode 没有返回错误。这是为什么?
func test(name: String) -> (String) { return name }
对于 0 或 1 个元素的元组有特殊处理。就类型系统而言:
()
Void()
(T)
T