folpindo / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Operator != compiles but does not work as expected. #1076

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using arduino platform 1.0.1. Compiling and deploying to a Duemilanove board.

Let var be a boolean variable. The line

var = !var

toogles the boolean value of var, while the line

var != var

does nothing (keeps the value of var as it was before that line).

It should toogle the value of var as well.

Original issue reported on code.google.com by noe.ot...@gmail.com on 18 Oct 2012 at 1:49

GoogleCodeExporter commented 9 years ago
var != var actually means something else. It checks the two sides to see if 
they're equal or not. In this case, the code just doesn't do anything with the 
result. It is confusing, but that's what != is supposed to do.

Original comment by dmel...@gmail.com on 18 Oct 2012 at 2:01