Strings and bytes
- strings are just aliases for bytes
- strings are (generally?) immutable
package main
import "fmt"
func main() {
s := "some string"
fmt.Printf("%v %T\n", s, s)
b := []byte{65, 66, 66, 65}
fmt.Printf("%s %T\n", b, b)
}
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import "fmt"
func main() {
s := "some string"
fmt.Printf("%v %T\n", s, s)
b := []byte{65, 66, 66, 65}
fmt.Printf("%s %T\n", b, b)
}