4 ms·
The given answer is a hack. The real answer is "most languages can return multiple values", since whenever structs were introduced. And if you're bugged by the
by slashnull 13y ago
The given answer is a hack.
The real answer is "most languages can return multiple values", since whenever structs were introduced. And if you're bugged by the fact that there are multiple input parameters, well, just think of the list of params as a tuple. Which you could picture as anonymous structs anyways.
So that in the end, all functions take one tuple and return one tuple, where tuples can be called structs, classes, or, well, tuples.
The real question being, why is it that there is a syntactic sugar for anonymous input structs but that the sugar for output structs is just being introduced.
And there I have to admit I have no idea why.