paint-brush
Early Exit From Functionsby@msarica
555 reads
555 reads

Early Exit From Functions

by Mehmet2mAugust 2nd, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Early Exit From Functions is a good way to keep the code readable and maintainable. One of the easiest ways to increase readability is terminating early from methods/functions. The structure looks a lot simpler when we put the exits on top. If the exit logics are getting mixed and complicated that might be a good sign to split up the function to smaller functions. Exiting a function early almost always makes the function more readable. If we start writing a recursive function, we start with the exit logic.

Company Mentioned

Mention Thumbnail
featured image - Early Exit From Functions
Mehmet HackerNoon profile picture
Mehmet

Mehmet

@msarica

msarica.com

About @msarica
LEARN MORE ABOUT @MSARICA'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Mehmet HackerNoon profile picture
Mehmet@msarica
msarica.com

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite