Javatpoint Logo
Javatpoint Logo

F# Bitwise Operator

In F#, bitwise operator works on individual bits and return result after evaluation.

Symbol Description
&&& Bitwise And operator
||| Bitwise OR operator
^^^ Bitwise exclusive OR operator
~~~ Bitwise negation operator
<<< Bitwise left shift operator
>>> Bitwise right shift operator

F# Bitwise Operator Example

The bitwise AND operator (&) compares each bit of the first operand to the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.

In the above code, 0xFFFF is a hexadecimal number which is equivalent to binary ? 1111.

0xAAAA is a hexadecimal value which is equivalent to binary ? 1010.

So if we do it manually like - 1111 &&& 1010 = 1010 is result which is equivalent to AAAA in hexadecimal.

Output:

AAAA
FFFF




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA