I'm a Software Engineer, who loves to devote all the time I can get, to assisting and guiding other learners with all the resources and knowledge I can afford.
In the end, I guess the point is to make the code more readable. In your example, for sure, the early returns can look more obvious to read. In many cases, they make people lose the flow and intention of the code.
My own preference would certainly depend upon the specific case under consideration, but this was a piece of general advice I have received from many throughout my journey.
Anyway, the main idea of mentioning early returns in the article was to explain that they exist and can be used as an exit from a function (as a function output), but if they complicate the readability too much, it's better to have a single return.
Thanks for the answer, I agree we always need to be cautious about readability !
I always like to challenge my knowledge and the things I do without even thinking about them, it's cool to read some interesting articles that help me do so ππ½
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Haha, thanks. π
In the end, I guess the point is to make the code more readable. In your example, for sure, the early returns can look more obvious to read. In many cases, they make people lose the flow and intention of the code.
My own preference would certainly depend upon the specific case under consideration, but this was a piece of general advice I have received from many throughout my journey.
Anyway, the main idea of mentioning early returns in the article was to explain that they exist and can be used as an exit from a function (as a function output), but if they complicate the readability too much, it's better to have a single return.
Even my PokΓ©mon knowledge is rusty now. Looking forward to the Diamond and Pearl remakes, and PokΓ©mon Legends. :D
Hope you'll stick around for more! Take care!
Thanks for the answer, I agree we always need to be cautious about readability !
I always like to challenge my knowledge and the things I do without even thinking about them, it's cool to read some interesting articles that help me do so ππ½