位运算内容很多的,位运算可以判断奇偶,数值交换等
package main
func main() {
var a, b = 611, 193
//A = 110
a = a ^ b
b = a ^ b
a = a ^ b
println(a, b)
}
package main
func main() {
var a, b = 611, 193
//A = 110
a = a ^ b
b = a ^ b
a = a ^ b
println(a, b)
}
2018-04-29
iota前面的常量必须先赋值,如下面是错误的:
package main
import (
"fmt"
)
const (
a
b = iota
c
)
func main() {
fmt.Println(a, b, c)
}
package main
import (
"fmt"
)
const (
a
b = iota
c
)
func main() {
fmt.Println(a, b, c)
}
2018-04-29