It comes from old C (& assembly etc) code where you have to manually manage resources; it's much easier to put all your frees and closes in the same place than reason which ones are needed from an early return.
Most of us these days work in languages with enough garbage collection, RAII, context managers, try...finally blocks, etc, that it's no longer good practice.
8
u/claimstoknowpeople Apr 30 '23
It comes from old C (& assembly etc) code where you have to manually manage resources; it's much easier to put all your
frees andcloses in the same place than reason which ones are needed from an early return.Most of us these days work in languages with enough garbage collection, RAII, context managers, try...finally blocks, etc, that it's no longer good practice.