4 ms·
I recall this pattern being taught in my first year or two of my computer science degree. Emphasizing only one return statement per function, utilizing a shared
by speedyapoc 5y ago
I recall this pattern being taught in my first year or two of my computer science degree. Emphasizing only one return statement per function, utilizing a shared return variable.
I much preferred (and still greatly prefer in industry) the pattern of exiting the function as soon as possible.
- jbverschoor 5y agoSame here. Returning and throwing quickly and strict.
- cryptonector 5y agoIt's like "goto considered harmless" -- structured code to max, to the point of unreadability. Dogmatism has drawbacks.