Boolean operators precedence

Mika picture Mika · Sep 19, 2012 · Viewed 35.1k times · Source

I would like to know if operator precedence in programming languages depends on implementation or there is a fixed rule that all languages follow. And if possible, could you order the following operators with highest precedence first: AND, OR, NOT, XOR.

Answer

emiljho picture emiljho · Sep 19, 2012

I googled and found out this which says that some languages like APL and SmallTalk do not have operator precedence rules and they strictly evaluate expressions from left to right/left to right.

However,relative order of precedence followed is NOT > XOR > AND > OR in most of the languages especially those derived from C