# Compare 2 boolean variables

**URL:** <https://community.homey.app/t/compare-2-boolean-variables/115858>\
**Category:** Flows\
**Created:** [September 11, 2024, 1:43pm UTC](https://community.homey.app/t/compare-2-boolean-variables/115858 "2024-09-11T13:43:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aste](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/aste/32/9729_2.png) [@aste](https://community.homey.app/u/aste)\
**Post date:** [September 11, 2024, 1:43pm UTC](https://community.homey.app/t/compare-2-boolean-variables/115858/1 "2024-09-11T13:43:39Z")

</div>

EDIT SOLVED: See bottom of post.

I’m trying to compare 2 boolean variables.

IF A or B is changed AND A=B THEN do something ELSE do something else

If I use the logic AND card “var A operator equals var B is true” I get an error “Left-side Is Non Numeric”.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/2/92eb2619f3ad5586367380cee0e323391447b67f.png)

If I use the same logic AND card but calculates {{A+B}} equals 0. It works. But I need both 0 and 2 to return true. So I tried to different variants of using OR to the right.  
0 OR 2  
{{0}} OR {{2}}  
{{0 OR 2}}  
They all fail.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/5/d50fd488b4fb09c8702d367301a65cd7de3afd98.png)

Is it possible to compare 2 boolean variables using the built in logic in one card?

For context, I’m coming from Better Logic and want to move to a more visual solution that is easier to expand when more family members needs to be included in all the logics 😉  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/5161e6b85af7d22806d5365ea1ab347224e117ee.png)

EDIT: Just solved it. In this case , second option works with reverse logic.  
IF A OR B is changed AND {{A+B}} equals 1 THEN something else ELSE something.

I’ll leave the post here as I didn’t find any topic like this when searching the community.

---

<div class="post-metadata">

**Author:** ![Rmb](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rmb/32/79135_2.png) [@Rmb](https://community.homey.app/u/Rmb)\
**Post date:** [September 11, 2024, 3:31pm UTC](https://community.homey.app/t/compare-2-boolean-variables/115858/2 "2024-09-11T15:31:14Z")

</div>

You find a nice workaround, and “invented” [the XOR function] 😁 ([XOR gate - Wikipedia](https://en.m.wikipedia.org/wiki/XOR_gate)).
