2 ms·
I always say that if you know the answer, why convolute the code? Just return the damn answer and we're done here. I see these early returns as a list of assum
by Flow 8y ago
I always say that if you know the answer, why convolute the code? Just return the damn answer and we're done here.
I see these early returns as a list of assumptions. It helps making them nicely lined up, with perhaps some comments before each, and an empty line between them.
And then when you get below to the, now non-nested, code that actually does some work you have a smaller mental burden needed to understand what is actually done.