If else return break best practices
Lorenzo Tinfena
Posted on December 7, 2021
Do not write:
func () {
if (something)
return true;
return false;
}
Instead write:
func () {
if (something)
return true;
else
return false;
}
Do not write:
func () {
while (somehing)
if (somethingelse)
break;
}
Instead write:
func () {
while (somehing)
if (somethingelse)
return;
}
These are my current best practices, what do you think?
💖 💪 🙅 🚩
Lorenzo Tinfena
Posted on December 7, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.