I am trying to loop through 127 to 227; 512 to 612… in other words 2^n to 2^n + 100 for various n.
package main
import (
"fmt"
)
func main() {
for i := int(2e7); i < int(2e7) + 100; i++ {
fmt.Println(i, " - ", string(i), " - ", []byte(string(i)))
}
}
However, I get a weird output :
go run main.go
20000000 - � - [239 191 189]
20000001 - � - [239 191 189]
20000002 - � - [239 191 189]
20000003 - � - [239 191 189]
20000004 - � - [239 191 189]
20000005 - � - [239 191 189]
.
.
.
What’s the right way to write this piece of code?