I learned another very important thing about Ruby yesterday, which honestly I should have already known by heart. In Ruby there are operators such as 'and' and 'or', which do essentially what you would expect. There are also '&&' and '||' operators. There is also a 'not' operator the behaves similarly to the '!' operator.

Despite having been writing some Ruby for awhile now, I somehow didn't notice until yesterday that these operators are not just aliases for one another. I had been assuming that 'and' is just a syntactic alias for &&, but in fact it has a much lower precedence order than && does. The same is true of 'or' vs. ||, and 'not' vs. !

While && and || have higher precedence than the ternary ?: operator, 'and' and 'or' do not. The '!' operator is one of the highest in the order of precedence, while 'not' is one of the lowest.
Shared publiclyView activity