Apple documentation says,
"In-out parameters cannot have default values and variadic parameters cannot be marked as inout".
Why we are restricted from doing so?
Apple documentation says,
"In-out parameters cannot have default values and variadic parameters cannot be marked as inout".
Why we are restricted from doing so?
As of my understanding till now:
We can not pass Constant/Literals to input parameters. Because Constant/Literals are immutable and can not be changed.
But for Variadics, we can pass Constant/Literals as parameters. So if we can make the Variadics as inout, then it contradicts the above facts.
Regarding default values for Variadic parameter, the default value of Variadic parameter is an empty array. Playground image attached.
Let me know in case I have an incorrect understanding.