Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Finding out if a Parameter is Odd or Even?

Anonymous
Not applicable
I searched through the forum, but couldn't find an answer to this:

How do I find out if a user input (integer) parameter is odd or even in GDL script?

Basically I want to do something that says If num (user integer input) EVEN then GOSUB:A, IF num (user integer input) ODD then GOSUB:B.

I really appreciate your help, I am at a loss here.

Thanks.
1 REPLY 1
Anonymous
Not applicable
Another way of saying that an integer x is even is to say that x mod 2 = 0. So...
IF num MOD 2=0 THEN !num is even
    GOSUB A
ELSE
    GOSUB B
ENDIF
should do the trick.