Initialise and evaluate a map from strings to strings in Go
This is an example Go program which demonstrates initialising a map from strings to strings and then looping over it using range.
package main import ( "fmt" ) func main() { m := map[string]string{ "ceiling": "天井", "floor": "床", "wall": "壁", } for key, value := range m { fmt.Printf("%s is %s in Japanese.\n", key, value) } }
The output of the example looks like this:
ceiling is 天井 in Japanese. floor is 床 in Japanese. wall is 壁 in Japanese.
Copyright © Ben Bullock 2009-2024. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com).
/
Privacy /
Disclaimer