This is a creation in Article, where the information may have evolved or changed.
package main import ( "FMT") // get all even func even between 0-n (a int) (array []int) { for i := 0; i < a; i++ { if i&1 == 0 { // bitwise operators & As used in C language Array = append (array, i) } } return array} // swaps the value of two variables// does not need to use the third variable to do the intermediate variable Func swap (a , b int) (int, int) { a ^= b // xor equals operation b ^= a a ^= b return a, b} // left shift, right shift operation Func shifting (A int) int { a = a << 1 a = a >> 1 return a} Transform symbol func nagation (a int) int { // NOTE: c language is ~a+1 this way return ^a + 1 // The go language is different from the C language, the go language does not support the ~ symbol. } func main () { fmt. Printf ("even: %v\n", even (+)) a, b := swap (100, 200) fmt. Printf ("swap: %d\t%d\n", a, b) fmt. Printf ("shifting: %d\n", shifting (+)) fmt. Printf ("nagation: %d\n", nagation (100))}