Your syntax is incorrect. To make an alphabetic map (as pseudo-constant), you can do:
var romanNumeralDict = map[int]string{ 1000: "M", 900 : "CM", 500 : "D", 400 : "CD", 100 : "C", 90 : "XC", 50 : "L", 40 : "XL", 10 : "X", 9 : "IX", 5 : "V", 4 : "IV", 1 : "I", }
Inside func you can declare it as:
romanNumeralDict := map[int]string{ ...
And in Go there is no such thing as a permanent map. More information can be found here .
Try it on the Go Playground.
squiguy Aug 20 '13 at 18:21 2013-08-20 18:21
source share