Created
July 18, 2011 09:02
-
-
Save alecmce/1088960 to your computer and use it in GitHub Desktop.
one return per method
This file contains hidden or 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
// a difference is not a difference unless it *makes* a difference | |
public function add(item:*):Boolean | |
{ | |
if (contains(item)) | |
return false; | |
push(item); | |
return true; | |
} | |
public function add(item:*):Boolean | |
{ | |
var notContained:Boolean = !contains(item); | |
if (notContained) | |
push(item); | |
return notContained; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm with squeedee. Guard clauses rule; conditional slaloms drool.