--

I don’t agree. In fact in Go, the linter will correct you the other way. The +44 case is clearly bad code - you should never be returning the code without an else or if clause checking the country in that case. But that’s not a general argument for not using implicit else at all. There’s equally a danger in using explicit else that you will leave the function to return nothing at all because you didn’t catch every case. In short, there’s nothing wrong with using the implicit else if you’re being smart about it. It depends entirely on the case.

--

--

Pierz Newton-John
Pierz Newton-John

Written by Pierz Newton-John

Writer, coder, former psychotherapist, founding member of The School Of Life Melbourne. Essayist for Dumbo Feather magazine, author of Fault Lines (fiction).

No responses yet