+ 1

# Which one will work first between && and ||. If their precedence is same what's the associativity(left to right/right to left)

3 Answers

+ 2

You mean the speed of the operators "and" / "or"? there will be not much difference, They will take longer if the expresion to evaluate are longers.

+ 1

AND/OR operators don't have a precedence over each other like mathematical operators have. If you want either of the two operators to evaluate first, just put it inside parenthesis.
For example, ((a&&b)||c) , in this case && will be checked first.

0

No. I mean the precedence