+ 1

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

29th Dec 2016, 1:23 AM
Jawwad Hossain
Jawwad Hossain - avatar
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.
29th Dec 2016, 1:27 AM
Nahuel
Nahuel - avatar
+ 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.
29th Dec 2016, 1:34 AM
Yousaf
Yousaf - avatar
0
No. I mean the precedence
29th Dec 2016, 1:28 AM
Jawwad Hossain
Jawwad Hossain - avatar