Things become a little trickier with languages that do not have early return, such as Elixir ;)
This is not good approach. There is only one sufficient principle in the craft: Every tool has its purpose and do not use a tool for a wrong purpose.
Not using a tool at all protects you when you do not know its purpose and how to use it properly. Also not using a common tool just to be protected from ignorance tells about amount of ignorance.
Quite ironic of you to mention the Line of Sight rule and then present the code examples in one line.
Very interesting! I also dont like it to use else statements except in ternary expressions.
Maxi Contieri
Software Engineer
Nice article!
I agree that else statements are problematics, hard to read as you mention. But I'd go one step further and remove IFs altogether!!
Without IFs there are no elses!