# Interchanging HIGH/LOW with true/false

**URL:** <https://forum.arduino.cc/t/interchanging-high-low-with-true-false/146611>\
**Category:** Programming\
**Created:** [February 21, 2013, 7:48am UTC](https://forum.arduino.cc/t/interchanging-high-low-with-true-false/146611 "2013-02-21T07:48:17Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [February 21, 2013, 10:50am UTC](https://forum.arduino.cc/t/interchanging-high-low-with-true-false/146611/7 "2013-02-21T10:50:16Z")

</div>

> michinyon:  
> Some people advocate writing code like
> 
> ```arduino
> boolean state = ( HIGH == digitalRead(3) )
> 
> ```
> 
> The reason to do this, is that you will get a compiler error if you type the wrong number of equals signs.

Personally I err on the side of extra brackets. Yes, it may look a little more crowded, but you can then be 100% certain what order things are going to happen in. Some of the order of precedences can be a little grey - if you have two operators that have the same order of precedence, which one will happen first? And can you remember the order of precedence of ALL the operators off the top of your head? Thought not. I have a good memory, and I can't - only that \* and / happen before - and + (as taught in maths lessons when you're 6). So, add brackets to make it explicit. Assembly doesn't use brackets, so it shouldn't make the slightest bit of difference to the quality of the resultant code, but it might make all the difference to your calculations.

---

_[View the full topic](https://forum.arduino.cc/t/interchanging-high-low-with-true-false/146611)._
