The be specific the '=' operator always assigns a value to a variable and returns that same value as its result. It has nothing to do with 'equals' comparison at all. The '==' operator does comparison and returns true or false. Its very easy to be caught out by this, mainly because you are allowed to use '=' in an expression.
The plus side is that you can write:
a = b = c = 0 ;
Which is interpreted as if it were:
a = (b = (c = 0)) ;
So your code that did if ( sensorValue = HIGH)
was setting sensorValue to HIGH then returning HIGH (which is equivalent to true) as the if-test.