Bitwise and Conditional Operators
Learn about different bitwise and conditional operators in Solidity.
We'll cover the following...
In this lesson, we’ll explore bitwise and conditional operators in Solidity. These operators offer specialized capabilities that allow us to work with individual bits and create conditional expressions with concise syntax. Additionally, we’ll explore the conditional operator, which provides an elegant method for making decisions.
Bitwise operators
These operators are used to carry out operations at the bit level. The following bitwise operators are supported by Solidity:
Bitwise AND (
&
): The boolean AND operation is applied to each bit of the integer input.Bitwise OR (
|
): The boolean OR operation is applied to each bit of the integer input.Bitwise XOR (
^
): The boolean exclusive OR (XOR) operation is applied to each bit of the integer input.Bitwise Not (
~
): ...