bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/Go/Go Tutorial
Go•Go Tutorial

Go Bitwise Operators

Bitwise Operators

Bitwise operators are used on (binary) numbers:

OperatorNameDescriptionExample
&ANDSets each bit to 1 if both bits are 1x & y
ORSets each bit to 1 if one of two bits is 1xy
^XORSets each bit to 1 if only one of two bits is 1x ^ b
<<Zero fill left shiftShift left by pushing zeros in from the rightx << 2
>>Signed right shiftShift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall offx >> 2

Previous

Go Logical Operators

Next

Go Conditions