ActionScript 3 Working with numerical values Whether a number is an even value


Example

function isEven(n:Number):Boolean {
    return ((n & 1) == 0);
}

Examples:

isEven(1); // false
isEven(2); // true

isEven(1.1); // false
isEven(1.2); // false
isEven(2.1); // true
isEven(2.2); // true