How do I check is a variable odd or even number?

Get help using Construct 2

Post » Mon Jul 13, 2015 5:16 pm

is it possible to check a variable odd or even ?
B
4
Posts: 9
Reputation: 222

Post » Mon Jul 13, 2015 5:27 pm

I guess this should work:

system compare two values : variable%2 = 0
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jul 13, 2015 8:25 pm

Or you can bitwise and with 1 which extracts the 2^0 bit from a number. You sometimes have to be careful with modular arithmetic as negative numbers can be odd.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, jorgmaquoi, Kermad, yiuyiu6666 and 10 guests