AS3: check number if...
AS3: check number if...
Out of context: Reply #2
- Started
- Last post
- 5 Responses
- fyoucher10
var isMatch_bool:Boolean = false;
var num:int = 69;
// The number to compare withvar compareNums_array:Array = [19, 39, 59, 79];
// Numbers you're checking//Reusable function
function isMatch (arr:Array):Boolean {
for (var i:int = 0; i < num_array.length; i++ ) {
if ( num == compareNums_array[i] ) {
trace ("We gotta match.");
return true;
}
}
}// Checking shit out
isMatch (compareNums_array) ; // FalseThere's probably a better way to do this but I've been drinking too much.