Operators and Built-in Functions

Go supports the normal set of numerical operators. See for lists the current ones and their relative precedence. They all associate fromleft to right.

PrecedenceOperator(s)
Highest* / % << >> & &^
`+ -
== != < <= > >=
<-
&&
Lowest||

Operator precedence.

+ - * / and % all do what you would expect, & | ^ and &^ are bitoperators for bitwise and bitwiseor bitwise xor andbit clear respectively. The && and ||operators are logical and and logical or Not listed in the table is the logical not !

Although Go does not support operator overloading (or method overloading forthat matter), some of the built-in operators are overloaded. For instance, +can be used for integers, floats, complex numbers and strings (adding strings isconcatenating them).