check if a number is a multiple of 2 (EVEN)


    Feb 11 2014 | 2:23 am
    can i make an else if statement that can check if a number is a multiple of 2 in other words (EVEN)
    what i was thinking was something like this:-
    if $i1 =/ 2 then out1 $i1 else out2 $i1
    any help would be great i feel like i'm overlooking a simple solution.
    many thanks in advance.
    MiRAGE

    • Feb 11 2014 | 2:37 am
      use modulo. [ if $i1 % 2 == 1 then odd else even ]
    • Feb 11 2014 | 2:58 am
      mod 2 of the absolute value of an integer is 0 if it's even and 1 if it's odd.
    • Feb 11 2014 | 6:18 am
      [& 1] is 0 if even, 1 if odd