[go-nuts] func return with if... else...

2017-01-14 Thread James Bardin
If you're "if" block returns, and there's nothing after the "else" block, then you don't need the "else" at all. -- 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

Re: [go-nuts] func return with if... else...

2017-01-14 Thread Paul Jolly
The compiler does understand the exhaustiveness of if ... else ... : https://play.golang.org/p/PAcg9oUAxA Can you post some code to highlight the problem you're having? On 14 January 2017 at 21:31, Eric Brown wrote: > Using go, when I create a function with a return... and that function uses >

[go-nuts] func return with if... else...

2017-01-14 Thread Eric Brown
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 poin