- From: Boris Zbarsky <bzbarsky@mit.edu>
- Date: Mon, 23 Mar 2015 14:58:59 -0400
- To: www-style@w3.org
On 3/23/15 2:26 PM, Simon Sapin wrote: > On 23/03/15 18:56, Henrik Andersson wrote: >> Given that or traditionally has lower predecease than and, it's >> certainly confusing. > > It does? I thought it more common for these operators to have the same > precedence and be left-associative. C, C++, Java, Go, JavaScript (I claim "C-inspired" here): && has higher precedence than || Python: "and" has higher precedence than "or". Perl: "and" has higher precedence than "or". Lisps: no weird precedence rules needed. ;) Haskell: && has higher precedence than ||. FORTRAN: Afaict, .AND./& has higher precedence than .OR./| Spreadsheets: typically AND and OR are functions, not operators. Visual Basic: And has higher precedence than Or. COBOL: AND has higher precedence than OR. Pascal: and has higher precedence than or. PHP: && has higher precedence than ||. Awk: && has higher precedence than ||. Mathematica: Afaict, && has higher precedence than ||. OCaml: && has higher precedence than ||. The only case I can think of offhand that I'm familiar with where boolean "and" has the same precedence as boolean "or" is Unix shell job control, where && and || are in fact equal precedence and left-associative. -Boris Source: http://rosettacode.org/wiki/Operator_precedence mostly.
Received on Monday, 23 March 2015 18:59:28 UTC