Bit wise option code?

Blitz3D Forums/Blitz3D Programming/Bit wise option code?

Here is a further variation, maybe useful to see what happens:

If (Flag And Glow) = Glow Then Print "Glow"

Let's say flag is 7 and Glow is 4

"(Flag AND GLow)" is an expression that forces a calculation. It will now set those bits in the result which are true in both, in Flag AND in Glow.

Flag: binary 0111
Glow: binary 0100

You see there is only one bit set in both numbers, the third bit. So the result is 0100

So
(%0111 AND %0100) = %0100
or we could say:
(7 and 4) = 4

If the third bit in Flag would not be set, then the result would be zero:
(3 and 4)=0
or
(0011 AND 0100) = 0000
because none of the bits are set in both variables.