odd or even

This post from Vinnie at the recently rolled blog FLAmous came through the MM aggregrator this morning. He provided an actionscript version of a function to determine if a number is odd or even and described the Modulo (%) operator. I’ve pulled out the AS2 data-typing so we can use it in authorware – a week old and I’m already pilfering the man’s code.

function evenNumber(number) {
    var isPositive = ( number>=0);
    var isInteger = (number%1 == 0);
    var even = (number%2 == 0);
    return isPositive && isInteger && even;

1 Response

  1. Samual says:

    April 14, 2015 at 11:21 pm

    You can definitely see your enthusiasm in the work you
    write. The arena hopes for more passionate writers such as you who are not afraid to mention how
    they believe. At all times go after your heart.
    site (Samual)

Leave a Reply