Puzzle 20 Explanation: Go Rune
Understand more about Unicode in Go.
We'll cover the following...
Try it yourself
Try executing the code below to see the result.
Press + to interact
package mainimport ("fmt")func main() {msg := "π = 3.14159265358..."fmt.Printf("%T ", msg[0])for _, c := range msg {fmt.Printf("%T\n", c)break}}
Explanation
Go strings are UTF-8 encoded. Go will access the underlying []byte
when we access a string with ...