3 ms·
I can see the benefit of the forced return, but only because it's bitten me in the past. In Python, if you don't say `return` the function returns `None`.
by davvid 13y ago
I can see the benefit of the forced return, but only because it's bitten me in the past.
In Python, if you don't say `return` the function returns `None`.
- laumars 13y agoThat's less of an issue for Go as aside interface{}, fundamental types can't be nil. Plus the instance we're talking about here is with named returns, so the variables are already initialised. From a personal perspective, I find having to include "return" a pain as there's times when it's completely unnecessary. eg in switch statements or if else where each condition has it's own return. While it's an easy fix for if else (just drop the else / default case), it makes the code look a little less pretty in my opinion.