Is there a way to put a condition that return true only if one of the two component return true?
BOOL var1 BOOL var2
something shorter than if((var1 && !var2) || (!var1 && var2))
Thank you
XOR is a bitwise operator, and it stands for "exclusive or." It performs logical operation. If input bits are the same, then the output will be false(0) else true(1).
(eXclusive OR) A Boolean logic operation that is widely used in cryptography as well as in generating parity bits for error checking and fault tolerance. XOR compares two input bits and generates one output bit. The logic is simple. If the bits are the same, the result is 0. If the bits are different, the result is 1.
It's just syntax, there's no technical reason for it. They just use YES/NO for their BOOL instead of true/false like c++ does.
As Objective-C is a superset of C, you simply use the XOR operator from C, which is ^
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With