Difference between `not` and `!` in ruby

They are almost synonymous, but not quite. The difference is that ! has a higher precedence than not, much like && and || are of higher precedence than and and or. ! has the highest precedence of all operators, and not one of the lowest, you can find the full table at the Ruby docs. As an example, consider: In the first example, ! has the highest precedence, so you’re effectively saying false && … Read more