Bill Allombert on Tue, 07 Dec 2021 19:36:39 +0100


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

Re: logical operators -- documentation


On Tue, Dec 07, 2021 at 05:13:27PM +0100, Paul Underwood wrote:
> Fellow users,
> 
> https://pari.math.u-bordeaux.fr/dochtml/html-stable/operators.html
> 
> shows left associativity of logical operators, || and &&.
> 
> But in the latest version it is right associative.
> 
> For example:
> 
> for(n=1,9,if(1<0 && 3<2 || n%2==1,print1(n" ")))
> 1 3 5 7 9

It seems there is some terminological issues here.
Since no operator appear twice, there is no associativity in your
example.

a && b || c is read as (a && b) || c

Maybe the word is precedence ?

Cheers,
Bill