0
What does '^' symbol stands for and how it works?
3 Answers
+ 1
Means Xor and is true if 1 operant is true and the other one is false and if both operants are true or false it ouputs false
x=true
y=false
x^y = true
works the same as
if((x===true&&y===true)||(x===false&&y===false)){print("false")}
else if((x===false&&y===true)||(x===true&&y===false){print("true")}
+ 3
Like Maz say, its xor operator... Its called "exclusive or" and you can remember it with: It return true if operands are differents (one exclude other) else return false
+ 1
its the xor operator.
0^0=0
1^1=0
0^1=1
1^0=1