Some information source on operator precedence like this says that unary operators like !, ~, +, - have higher precedence than assignment =. However, the following expressions are possible:
!a = true # => false (with warning)
a # => true
~a = 1 # => -2
a # => 1
+a = 1 # => 1
a # => 1
-a = 1 # => -1
a # => 1
Considering these results, the only possible explanation I can think of is that these unary operator have lower precedence than the assignment. If that is the case, then it would mean that the information I mentioned above is wrong. Which is correct? Is there a different explanation?
~a = 1appears to behave like~(a = 1). - David Grayson