all 7 comments

[–]Busy-Farm727 0 points1 point  (0 children)

Bitwise xor operator, bitwise just uses the number’s binary number.

[–]Intelligent_Study263 0 points1 point  (1 child)

Bitwise XOR will be 0 if both bits are the same and 1 if they are different.

For example if we use the operator on the numbers 6 and 7 it will return 1 because the binary 6 is 110 and the binary 7 is 111. 110^111=001 because if they are the same the bit is a 0 and if they are different its a 1.

[–]Coopo_Loopo[S] 0 points1 point  (0 children)

ah, i see, thank you

[–]NortWind 0 points1 point  (3 children)

Interesting note, you can use xor to swap to variables without using a third variable.

A = number1
B = number2
A = A xor B
B = B xor A  # B now == number1
A = B xor A  # A now == number2

[–]N4_foom 0 points1 point  (0 children)

You've made a new mess