4 ms·
Sort of, you can actually get away with invoking a function and not assigning its result at all I think assigning the error to _ is only necassary when you hav
by Djehngo 14y ago
Sort of,
you can actually get away with invoking a function and not assigning its result at all
I think assigning the error to _ is only necassary when you have multiple return values(one of which is the error) and you are interested in at least one of them.
e.g.
returnsTwoValues()
is legal
x := returnsTwoValues()
is not
maps are also interesting because
value := someMap[key]
is valid and
value, keyIsPresent := someMap[key]
is also valid.