Discussions
'Number of return values' in Swift?
almost 8 years ago by Mario Negro
Hello.
As Swift allows the return of tuples it could be interesting to apply this rule as it is applied in Go. For example, this is the explanatory code in Go translated to Swift:
func yoloSwag() -> (Bool, Bool, Bool, String, Bool, Error?) {
// do some crazy work
return (false, true, false, "bacon", true, nil)
}
// Using
let (_, _, _, content, _, error) = yoloSwag()
if let error = error {
fatalError(error)
}
print(content)
Is it in the roadmap the addition of this rule to Swift?
Thank you so much.
Regards.