4 ms·
I sold my first program aged 15 and I'm 53 now. My experience is that the benefit of early return is to keep indentation to a minimum. To me, every time code
by Wildgoose 9y ago
I sold my first program aged 15 and I'm 53 now. My experience is that the benefit of early return is to keep indentation to a minimum. To me, every time code indents it is a "context switch".
Having said that, early return should be for error/ignore situations - there should only be one return for a result and that should be at the very end of the function.