On Sunday, 30 July 2023 at 09:40:25 UTC+1 DrGo wrote:
orelse must return an error (ie satisfies the error interface); the
specific type and variable name do not matter.
But how does "orelse" perform the check in the first place? Does it look
for the variable named in the return statement?
var foo error
r, bar := os.Open(src) orelse return foo // does this do "if foo != nil {
return bar }" ??
Also, you are explicitly allowing bare return. In that case, does it look
at the return values in the function definition? If the function returns
multiple values, how does it know which one?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/538f952f-0ad1-4d5f-ac6e-ceb2ab59e6aen%40googlegroups.com.