Which one will work first between && and ||. If their precedence is same what's the associativity(left to right/right to left) | SoloLearn: Learn to code for FREE!

+1

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

12/29/2016 1:23:09 AM

Jawwad Hossain

3 Answers

New Answer

+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