+ 3
Can someone plz explain == and OR
It's bit tricks for me I need general level explanation for above question?
7 Respostas
+ 5
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
+ 5
== (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
+ 2
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:
+ 1
Can u explain this
0
>>> False == False or True
True
>>> False == (False or True)
False
>>> (False == False) or True
True
0
Thanks Taste
0
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