Let's say I have a function with 3 return values. I set the values of 2 of them, and want to leave the 3rd one to default if I do not set it. Something like this -
func call(a int) (int, int, r3 string){
// return a, a+1, "no error" // stmt 1
// return a, a+1 // stmt 2
// return // stmt 3
}
Running with stmt 2 or stmt 3 uncommented, I get below error -
duplicate argument int
int is shadowed during return
How is int shadowed here? The return list does not have named int params.
Running with stmt 1 uncommented, I get below error -
duplicate argument int
cannot use a (type int) as type string in return argument
cannot use a + 1 (type int) as type string in return argument
Can someone explain origin of these errors ?
Is it not possible to have partial list of named result params (or even returning variables when using named result params) ?