# Bit operator in expression language

**URL:** <https://forum.inductiveautomation.com/t/bit-operator-in-expression-language/84178>\
**Category:** Ignition\
**Created:** [January 12, 2024, 10:58am UTC](https://forum.inductiveautomation.com/t/bit-operator-in-expression-language/84178 "2024-01-12T10:58:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 12, 2024, 11:13am UTC](https://forum.inductiveautomation.com/t/bit-operator-in-expression-language/84178/2 "2024-01-12T11:13:29Z")

</div>

You're using Bitwise AND where you should be using Logical AND.

`if(47 & 64, true, false)` returns `false`.  
`if(48 & 64, true, false)` returns `false`.  
`if(47 && 64, true, false)` returns `true`.  
`if(47 && 64, true, false)` returns `true`.  
`if(0 && 64, true, false)` returns `false`.

So, you don't need the `> 0` and since you are returning a bool you don't need the `if()`. You can replace the whole lot with the expression,  
`i && 64`

[https://docs.inductiveautomation.com/display/DOC81/Expression+Language+and+Syntax#ExpressionLanguageandSyntax-Operators](https://docs.inductiveautomation.com/display/DOC81/Expression+Language+and+Syntax#ExpressionLanguageandSyntax-Operators)

See also, [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831)

---

_[View the full topic](https://forum.inductiveautomation.com/t/bit-operator-in-expression-language/84178)._
