【发布时间】:2020-03-10 22:56:17
【问题描述】:
在下面的代码中,我希望 Xcode 不接受,因为我在代码主体中使用字符串作为返回值,而不是元组。但是由于某种原因,Xcode 没有返回错误。这是为什么呢?
func test(name: String) -> (String) {
return name
}
【问题讨论】:
-
T和(T)是同一种类型,比较stackoverflow.com/questions/24767681/…。
标签: swift string function return tuples