Complete the code to print "Hello, World!" in Go.
package main import "fmt" func main() { fmt.[1]("Hello, World!") }
The Println function prints the text followed by a new line.
Complete the code to declare a variable named "count" of type int with value 10.
package main
func main() {
var count [1] = 10
}The variable count is declared as an integer using int type.
Fix the error in the code to correctly create a slice of strings named "fruits".
package main
func main() {
fruits := [1]{"apple", "banana", "cherry"}
}In Go, a slice of strings is declared as []string.
Fill both blanks to create a map from string to int and add a key-value pair.
package main
func main() {
ages := make(map[string][1])
ages["Alice"] = [2]
}The map stores integers as values, so the type is int. The value assigned to "Alice" is 25.
Fill all three blanks to define a function that returns the sum of two integers.
package main func [1](a [2], b [2]) [3] { return a + b }
The function is named add, takes two integers, and returns an integer.
