If you have a catch-all, is it better to use after an if condition without
an else, or put it in an else:
if condition {
return A
}
return B
or:
if condition {
return A
} else {
return B
}
Just curious is there is a prefered standard to this for readability, or if
it's just to each their own...
On Saturday, January 14, 2017 at 3:31:32 PM UTC-6, Eric Brown wrote:
>
> Using go, when I create a function with a return... and that function uses
> an if... else... condition w/ the return being passed under each, the
> compiler still throws an error 'missing return at end of function'? I can
> put a return at the end of the function, but it will never get to that
> point because of this condition. Is that expected, or could I be doing
> something different to prevent this outcome? Not that it matters... but I
> hate just having random returns at the bottom of functions that don't do
> anything other than satisfy this issue.
>
--
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].
For more options, visit https://groups.google.com/d/optout.