Skip to content

Commit 2ea39c3

Browse files
committed
Adds create a map eg
1 parent 081f5e3 commit 2ea39c3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

codes/ch5_maps/create-a-map.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
/**
4+
* Note: The code will not run and throw an error: prefixMap declared and not used
5+
* As we have declare map and not used in and this is error in go-lang
6+
*/
7+
func main() {
8+
9+
/**
10+
* Declare a map of map type with string.
11+
* var <variable-name> map[<key-type>] <value-type>
12+
*/
13+
var prefixMap map[string] string
14+
15+
/**
16+
* make will initialize the map; if we don't use make
17+
* declaration will set to null;
18+
*/
19+
prefixMap = make(map[string] string)
20+
21+
}

0 commit comments

Comments
 (0)