Go Medium 1
š§ Code Challenge
package main
import (
"fmt"
)
func greetUsers(users map[string]int) {
for name, age := range users {
if age >= 18 {
fmt.Printf("Hello, %s! You are an adult.\n", name)
} else {
fmt.Printf("Hi, %s! You're still a minor.\n", name)
}
}
}
func main() {
userList := map[string]int{
"Alice": 22,
"Bob": 16,
"Carol": 30,
}
greetUsers(userList)
}
Explain what this function does. Speak clearly and use keywords.