Complete the code to declare a function named greet.
func [1]() { fmt.Println("Hello!") }
func.The function name is greet. This declares a function called greet that prints "Hello!".
Complete the code to declare a function that returns an integer 5.
func getNumber() [1] { return 5 }
The function returns an integer, so the return type is int.
Fix the error in the function declaration to accept a string parameter named name.
func greet([1] string) { fmt.Println("Hello,", name) }
var inside parameter list.The parameter name should be name followed by its type string.
Fill both blanks to declare a function that takes two integers and returns their sum.
func add(a [1], b [2]) int { return a + b }
Both parameters are integers, so both blanks should be int.
Fill all three blanks to declare a function that takes a string and an int, and returns a formatted string.
func formatMessage(name [1], age [2]) [3] { return fmt.Sprintf("%s is %d years old", name, age) }
The function takes a string and an int, and returns a string.
