3 ms·
If I put all my early exits at the start, for the remainder of the function I only have to remember the list of preconditions established by the early exits. Wi
by wongarsu 8y ago
If I put all my early exits at the start, for the remainder of the function I only have to remember the list of preconditions established by the early exits. With deeply nested code I instead have to keep a stack of currently fulfilled conditions in mind.
Sure, at any given point the stack is shorter than the list so there's less things to keep in mind, but for me dealing with mental lists is much easier than dealing with mental stacks.