File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
10-maps/05-map-access-keys Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 1
1
package main
2
-
3
2
import "fmt"
4
3
5
4
func main () {
6
- var employeeSalary = map [string ]float64 {
7
- "John" : 78000.00 ,
8
- "Steve" : 160000.50 ,
9
- "David" : 85000.00 ,
5
+ var personMobileNo = map [string ]string {
6
+ "John" : "+33-8273658526" ,
7
+ "Steve" : "+1-8579822345" ,
8
+ "David" : "+44-9462834443" ,
10
9
}
11
10
12
- var salary = employeeSalary ["Steve" ]
13
- fmt .Printf ("Steve's Salary = %f \n " , salary )
11
+ var mobileNo = personMobileNo ["Steve" ]
12
+ fmt .Println ("Steve's Mobile No : " , mobileNo )
14
13
15
14
// 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
- }
15
+ mobileNo = personMobileNo ["Jack" ]
16
+ fmt .Println ("Jack's PhoneNo : " , mobileNo )
17
+ }
You can’t perform that action at this time.
0 commit comments