August 2021
Beginner
112 pages
1h 23m
English
| Puzzle 20 | What’s in a String? |
| | package main |
| | |
| | import ( |
| | "fmt" |
| | ) |
| | |
| | func main() { |
| | msg := "π = 3.14159265358..." |
| | fmt.Printf("%T ", msg[0]) |
| | for _, c := range msg { |
| | fmt.Printf("%T\n", c) |
| | break |
| | } |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: uint8 int32
Go strings are UTF-8 encoded. When you access a string with [] or with len, Go will access ...
Read now
Unlock full access