I am quite confused about the go left shift operator. I run the following code:
package main
func main(){
var x = 1 << 0
println(x)
}
And I get 1. But I think the result should be zero.
I am quite confused about the go left shift operator. I run the following code:
package main
func main(){
var x = 1 << 0
println(x)
}
And I get 1. But I think the result should be zero.
1 << 0 means:
Take 1 and don't shift it. The result should be the original number: 1