Operator and syntax
Go bitwise operators
Integer bit operations: AND, OR, XOR and bit clear. Unary ^ complements bits. Bit clear a &^ b clears bits of a where b has set bits. Example output: '2 7 5 4 249'.
Formal Syntax & Structure
go syntaxgo
& | ^ &^Working Example
Example Snippetgo
package main
import ( "fmt")
func main() { a, b := uint8(6), uint8(3) fmt.Println(a&b, a|b, a^b, a&^b, ^a)}