How does | and ^ work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

How does | and ^ work?

21st Feb 2017, 10:55 AM
Helena Talaso
Helena Talaso - avatar
5 Answers
+ 11
thanks guys. it seems like a challenge to do this mentally though.
21st Feb 2017, 12:10 PM
Helena Talaso
Helena Talaso - avatar
+ 9
@Karlxu I used to find << and. >> to be tough, but I don't have a problem with those these days. Let me work on the | and ^ also. Thank you all for your assistance, you have been very helpful!
21st Feb 2017, 12:18 PM
Helena Talaso
Helena Talaso - avatar
+ 2
@Susan O yeah, do it on mobile a bit hard. also have other operator >> and <<
21st Feb 2017, 12:12 PM
karlxu
karlxu - avatar
+ 2
or, alternatively, you could talk about sets, in that case: | is the union operator: {1,2,3}|{2,3,4}={1,2,3,4} ^ is the symmetric difference operator. It gives you the elements of the first set that are not in the second, union the elements in the second set that are not in the first: {1,2,3}^{2,3,4}={1,4}
21st Feb 2017, 1:46 PM
Amaras A
Amaras A - avatar
+ 1
first need covert decimal number to binary, then do logic compute bit by bit.
21st Feb 2017, 11:48 AM
karlxu
karlxu - avatar