# Thread: why this OR expression wo'nt work

1. ## why this OR expression wo'nt work

attached is a screenshot of the example
just doesn't work right why?

2. Hi, for line 2 you can have if EditValue is different from 3. Otherwise you could separate it like this:Screenshot (26).jpg

3. using OR in the expression editor is different to the OR condition in the event editor (the working solution @Lukiester posted)

in the expression editor, OR uses logic operators, a special way of performing simple logic checks

the OR operator checks to see if two values are at least a 1, that is:
0 OR 0 = 0
1 OR 0 = 1
0 OR 1 = 1
1 OR 1 = 1

as far as I can tell, Fusion treats numbers >1 the same as a 1 in logic operations - meaning "Edit Value == 0 OR 1 OR 2" is the same as checking "Edit Value == 1"

there are other operators as well, such as AND (which gives you a 1 if both numbers are a 1) and XOR (which gives you a 1 if one but *not* both are 1)
eg.
1 AND 1 = 0
0 AND 1 = 0
1 AND 0 = 0
0 AND 0 = 1

0 XOR 0 = 0
1 XOR 0 = 1
0 XOR 1 = 1
1 XOR 1 = 0

it's a bit confusing at first if you haven't come across them before, but they're very useful for comparing two flags in a single line in the expression editor. hope this provides a bit of an explanation

4. ## thanx Lukiester and Marbenx

thanx Lukiester for the idea but i think ill try and shortcut it a bit and remove the ors
at the end of day I've come up with this
better.jpg
don't know if right because it plays up when putting in each entry into a list with "Only one action when event loops" for each event
betternot.jpg

5. As marbenx says, it's not that kind of "or". OR in an expression is a Bitwise OR (you can also do AND, XOR & I think NOT also). It just compares 2 values at a bit level to see if the bits at the corresponding positions of either value are set & returns the result.

The best way to do what it looks like you're trying to do is to have the "Edit value ("edit box") = 1/2/4/whatever" each as separate conditions in one event, & use "or (logical)" between each one. It's in the same right click menu as the "negated" option.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•