Skip to content

Commit 0c33ce6

Browse files
committed
Adds insert into map eg
1 parent 2ea39c3 commit 0c33ce6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package main
2+
3+
import "fmt";
4+
5+
func GetPrefix(name string) (prefix string) {
6+
7+
var prefixMap map[string] string
8+
prefixMap = make(map[string] string)
9+
10+
/**
11+
* Insert key and value into the map.
12+
*
13+
* <map-variable>[<key>] = <value>
14+
*/
15+
prefixMap["Ashwin"] = "Sr. Fullstack Engineer"
16+
prefixMap["Kumar"] = "Sr. Engineering Manager"
17+
prefixMap["Saju"] = "Sr. Solution Architect"
18+
prefixMap["Ajay"] = "Sr. solution Architect"
19+
20+
return prefixMap[name]
21+
}
22+
23+
func main() {
24+
25+
fmt.Println("What is Ashwin's role? He is " + GetPrefix("Ashwin"))
26+
27+
}

0 commit comments

Comments
 (0)