Skip to content

Instantly share code, notes, and snippets.

@jonnyreeves
Created June 27, 2012 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonnyreeves/3006933 to your computer and use it in GitHub Desktop.
Save jonnyreeves/3006933 to your computer and use it in GitHub Desktop.
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;
}
}
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