Created
February 9, 2015 22:26
-
-
Save eduardocruz/d94155dc0059b0f47bba to your computer and use it in GitHub Desktop.
Removing Unnecessary ELSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//BEFORE | |
function myFunction() | |
{ | |
if(userAuthorized()) | |
{ | |
execute(); | |
execute(); | |
execute(); | |
execute(); | |
} else { | |
return "Unauthorized Access"; | |
} | |
} | |
//AFTER | |
function myFunction() | |
{ | |
if( ! userAuthorized() ) | |
return "Unauthorized Access"; | |
execute(); | |
execute(); | |
execute(); | |
execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment