[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Operator precedence problem

On 2016-06-06 19:44, Random832 wrote:
> On Mon, Jun 6, 2016, at 13:07, Steven D'Aprano wrote:
>> Blimey, you're right. I always thought `and` and `or` had the same
>> precedence. And now that I know better, I have no doubt that I will
>> forget
>> it again.
> A good way to remember it is that "and" is analogous to multiplication,
> and "or" is analogous to addition. Which is, I assume, _why_ they have
> the same precedence. (why ^ is between | and &, though, is a mystery to
> me.)
In Pascal, "and" has the same precedence as "*" and "or" has the same 
precedence as "+".