What is the difference between XOR, OR, OR Else? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between XOR, OR, OR Else?

I am kinda confused and Google confuses me more can you guys please help understand

21st Oct 2019, 10:10 AM
StackOverride
StackOverride - avatar
1 Answer
+ 5
XOR:- This operator returns true(1) when both of it's inputs are different For example 0 XOR 1 -> 1 1 XOR 0 -> 1 But 1 XOR 1 ->0 also 0 XOR 0 ->0 OR:- It returns true(1) when any of the input is true(1) For example 1 OR 0->1 0 OR 1->1 And unlike XOR 1 OR 1->1 0 OR 0->0 OR ELSE:- it is similar to OR operator but it is more efficient because if first value is true(1) then it will not evaluate 2nd value at all it will directly give the result as true(1) Otherwise if first value is false(0) then it will evaluate 2nd value and give the result accordingly So even though it gives same result as of OR but it is faster
21st Oct 2019, 11:06 AM
Arsenic
Arsenic - avatar