Created
June 27, 2012 21:19
-
-
Save jonnyreeves/3006933 to your computer and use it in GitHub Desktop.
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
| package { | |
| public function matches(source : *, ...values):void { | |
| const len : uint = values.length; | |
| // Walk through the supplied values and look for a match. | |
| for (var i : uint = 0; i < len; i++) { | |
| if (source === values[i]) { | |
| return true; | |
| } | |
| } | |
| // No match. | |
| return false; | |
| } | |
| } |
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
| var name : String = "Jonny"; | |
| var found : Boolean = matches(name, "Bertie", "Billy", "Jonny", "Frankie"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment