Below
statements print key and values of map ‘employees’.
for key,
value := range employees{
fmt.Println("Key : ", key,
", Value : ", value);
}
HelloWorld.go
package main import "fmt" func main() { employees := make(map[int]string) employees[123] = "Krishna" employees[23] = "Ram" employees[67] = "Chamu" for key, value := range employees{ fmt.Println("Key : ", key, ", Value : ", value); } }
Output
Key : 123 , Value :
Krishna
Key : 23 , Value :
Ram
Key : 67 , Value :
Chamu
No comments:
Post a Comment