Can someone plz explain == and OR | Sololearn: Learn to code for FREE!


Can someone plz explain == and OR

It's bit tricks for me I need general level explanation for above question?

10/21/2018 7:00:35 AM


7 Answers

New Answer


its about operator precedence, or which operation need to be done first. just like 2+3*2=8 in this case == is done before OR so first one fasle==false -> true. true or true -> true (check) if parentheses exist they'll be done first (false or true) -> true. false == true -> false i guess you can work on the third one now


== (equal to) is a comparision operator, it'll check if the left side value and right side value are equal, if it is it'll return TRUE OR is logical operator which only take a boolean (TRUE/FALSE) or equivalent as the input, it'll always return true if one of either side or both side are TRUE


Operator Precedence Operator precedence is a very important concept in programming. It is an extension of the mathematical idea of order of operations (multiplication being performed before addition, etc.) to include other operators, such as those in Boolean logic. The below code shows that == has a higher precedence than or:


Can u explain this


>>> False == False or True True >>> False == (False or True) False >>> (False == False) or True True


Thanks Taste


I think you have god gifted logic (of course you have worked hard) But really amazing Also I have gone through profile. People like you are making out life's more simple