! has a higher precedence than not

! has a higher precedence than not

Share it now. It takes only a few seconds! 😉


! has a higher precedence than not

Difference between not and !

not true && false # => true  : not (true && false)
!true && false    # => false : (!true) && false

not and ! behind the scene

not is a keyword. Its logic is implemented within the internals of Ruby.

!obj is a unary operator. This operator is in fact a method : BasicObject#!@.

!true && false

is equivalent to

true.!@ && false

We're also available on