Let's say I wanted to turn on an LED only if, the value of one pot is >50 and the value of another pot is < 100, how would I write that?
if(value > 50 && value < 100)
http://www.cplusplus.com/doc/tutorial/operators/
Look under the Logical Operators section.
Osgeld:
if(value > 50 && value < 100)
Awesome thanks !!
Arrch:
http://www.cplusplus.com/doc/tutorial/operators/Look under the Logical Operators section.
Much appreciated! I just bookmarked for future reference.
its also under
Osgeld:
its also under
Sweet! Thanks again, I am bookmarking this as well.
Actually, you can use the word "and" instead:
http://en.cppreference.com/w/cpp/language/operator_alternative
I discovered this by accident recently... looked at some code I had written long ago and noticed I had used "and" instead of "&&" - couldn't figure out why it worked?
Using the alternative representations seems like a good way to avoid confusing the logical and bitwise operators.
even if it's possible, why use 'and'??
&& is a standard, get used to it