We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9f39fc commit 68f6d7fCopy full SHA for 68f6d7f
codes/ch5_maps/update-into-a-map.go
@@ -0,0 +1,31 @@
1
+package main
2
+
3
+import "fmt";
4
5
+func GetPrefix(name string) (prefix string) {
6
7
+ /**
8
+ * Short hand way to declare and initialize map
9
+ */
10
+ prefixMap := map[string] string {
11
+ "Ashwin": "Sr. Fullstack Engineer",
12
+ "Kumar": "Sr. Engineering Manager",
13
+ "Saju": "Sr. Solution Architect",
14
+ "Ajay": "Sr. Solution Architect", // comma is needed here
15
+ }
16
17
18
+ * Perform update operation on map.
19
20
+ prefixMap["Kumar"] = "Delivery Manager"
21
+ prefixMap["Ajay"] = "Sr. Project Manager"
22
23
+ return prefixMap[name]
24
+}
25
26
+func main() {
27
28
+ fmt.Println("What is Kumar's role? He is " + GetPrefix("Kumar"))
29
+ fmt.Println("What is Ajay's role? He is " + GetPrefix("Ajay"))
30
31
0 commit comments