Complete the code to declare a package in Go.
package [1]In Go, every file starts with a package declaration. The main package is used for executable programs.
Complete the code to import the fmt package.
import [1]fmt"
In Go, import paths are enclosed in double quotes "".
Fix the error in the function declaration by completing the code.
func [1]() { fmt.Println("Hello, Go!") }
The entry point function in Go programs is main with a lowercase 'm'.
Fill both blanks to create a map of string keys to int values with a condition.
ages := map[string]int{
"Alice": 30,
"Bob": 25,
"Carol": 27,
}
for name, age := range ages {
if age [1] 26 {
fmt.Println(name, "is older than", [2])
}
}The condition checks if age is greater than 26, and prints the name and age.
Fill all three blanks to create a slice of strings and print each element.
names := [][1]{"Anna", "Ben", "Cara"} for [2], [3] := range names { fmt.Println(index, name) }
The slice holds strings, and the for loop uses index and name to iterate and print each element.
