Mutables
Go
- package main
- import (
- "fmt"
- "strings"
- )
- thing[index] = strings.ToUpper(thing[index])
- }
- func upone_map(thing map[string]string, index string) {
- thing[index] = strings.ToUpper(thing[index])
- }
- func main() {
- // mutable
- upone_list(list, 1)
- fmt.Println(list) // [a B c]
- // mutable
- dict := map[string]string{
- "a": "anders",
- "b": "bengt",
- }
- upone_map(dict, "b")
- }