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 0c33ce6 commit a9f39fcCopy full SHA for a9f39fc
codes/ch5_maps/short-hand-way.go
@@ -0,0 +1,24 @@
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
+ return prefixMap[name]
18
+}
19
20
+func main() {
21
22
+ fmt.Println("What is Ashwin's role? He is " + GetPrefix("Ashwin"))
23
24
0 commit comments