Posted on 16th September 2024|15 views
How can I iterate over a map by using for loop in Golang?
Posted on 16th September 2024| views
You can refer this example:
package main
import "fmt"
func main() {
var employee = map[string]int{"Mahi": 100, "Rohit": 85,"Rahul": 80, "Hardhik": 70}
for key, element := range employee {
fmt.Println("Key:", key, "=>", "Element:", element)
}
}