• DarkMessiah@lemmy.world
    link
    fedilink
    arrow-up
    31
    arrow-down
    6
    ·
    edit-2
    11 months ago

    Just in case anyone was looking for a decent way to do it…

    if (((number/2) - round(number/2)) == 0) return true;
    
    return false;
    

    Or whatever the rounding function is in your language of choice.

    EDIT: removed unnecessary else.