We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 947d9f4 commit 031ae9eCopy full SHA for 031ae9e
10-maps/05-map-access-keys/main.go
@@ -1,18 +1,17 @@
1
package main
2
-
3
import "fmt"
4
5
func main() {
6
- var employeeSalary = map[string]float64{
7
- "John": 78000.00,
8
- "Steve": 160000.50,
9
- "David": 85000.00,
+ var personMobileNo = map[string]string{
+ "John": "+33-8273658526",
+ "Steve": "+1-8579822345",
+ "David": "+44-9462834443",
10
}
11
12
- var salary = employeeSalary["Steve"]
13
- fmt.Printf("Steve's Salary = %f\n", salary)
+ var mobileNo = personMobileNo["Steve"]
+ fmt.Println("Steve's Mobile No : ", mobileNo)
14
15
// If a key doesn't exist in the map, we get the zero value of the value type
16
- salary = employeeSalary["Jack"]
17
- fmt.Printf("Jack's Salary = %f\n", salary)
18
-}
+ mobileNo = personMobileNo["Jack"]
+ fmt.Println("Jack's PhoneNo : ", mobileNo)
+}
0 commit comments