While your example is technically correct and will work, the "standard" method is to place the variable before the comparison rather than after:
yes but my way "reads more like proze", as you can directly see that pot is between two values. The two operators are the same which makes reading easier
four statements, semantically equal and which one is more readable? it is a matter of taste.
if (500 < pot && pot < 520)
if (pot > 500 && pot < 520)
if (pot < 520 && pot > 500)
if (520 > pot && pot > 500)
If the test is complexer you can reduce the visual complexity by using only < and <= and ==
In the same way if the boolean expression includes x,y,z and some values you would keep the x's near each other and the y 's just to keep the visual complexity low?
On the other hand in a real app I would use an if then else ladder if there was more than 1 range to test, Please note they all have the same comparison operator! Such a ladder is quite easy for the compiler to optimize. OK you can argue that the most often occuring should be on top for performance .. ! but you will probably get complexer boolean tests.
pot = analogRead()
if (pot < 500)
else if (pot < 520)
else if (pot < 540)
else if (pot < 560)
// something else
// ok you got it
As you can see, I also prefer a different bracing style
fine as long as used consequently --> see - http://astyle.sourceforge.net/astyle.html