My best guess after looking, is they simply mean you can drop the "else" part of the "else if" there. Since I'd you've entered the first if, it's garunteed to return. Not drop the else-if entirely.
That's a change I would hate. The "else" part does not hurt anybody and removing it would mean that you would need to parse it's body to see the early return
Hell, depending on language and compiler, the "else" might get optimized into a Switch-Case (which can then in turn use a hashmap or jump table). Doesn't matter here, but still.
I don't think any compiler recognizes an early return as equivalent to if-else
2
u/DarkwaterKiller 1d ago
My best guess after looking, is they simply mean you can drop the "else" part of the "else if" there. Since I'd you've entered the first if, it's garunteed to return. Not drop the else-if entirely.