Difference between Bitwise, Bitwise exclusive, and Boolean "AND" + "OR" statements. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference between Bitwise, Bitwise exclusive, and Boolean "AND" + "OR" statements.

What's the difference between the Bitwise '&' and the Boolean 'and' expressions. They don't seem to do much else. Also, does the '~' mean.

13th Nov 2019, 6:45 PM
Riggonatio
Riggonatio - avatar
3 Answers
+ 3
https://code.sololearn.com/cMpDcIY1S7lY/?ref=app Bitwise operation works on an integer, it converts it to binary and executes the action bit by bit See this example for bitwise xor https://code.sololearn.com/cRXYx1v8t7IQ/?ref=app Edit: This code by Burey summarises bitwise operations perfectly. https://code.sololearn.com/WBOdrCZZT0a7/?ref=app Thanks ~ swim ~ for the link lower down that lead to this.
13th Nov 2019, 7:18 PM
Louis
Louis - avatar
+ 2
Thank you both Louis and ~ swim ~ for the help! All questions are answered!
13th Nov 2019, 9:29 PM
Riggonatio
Riggonatio - avatar
+ 1
I know what the operators mean but I don't know the difference, as I see it right now. To my knowledge the "and" and "or" is for Boolean. Bitwise I would assume goes with floats and integers.
13th Nov 2019, 7:11 PM
Riggonatio
Riggonatio - avatar