Every function starts with the func keyword, followed by a name, parameters in parentheses, and a body in braces. Here's a simple function that prints a greeting:
func greet() {
fmt.Println("Hello!")
}
To use the function, call it by name with parentheses: greet(). The code inside the braces runs each time you call it. Functions let you write code once and use it many times.