Functions
Lesson
1 / 4

Function basics

Functions use func keyword. Parameters have name before type.

main.go
func greet(name string) {
    fmt.Println("Hello,", name)
}

func add(a int, b int) int {
    return a + b
}

result := add(5, 3)  // 8
🔧

Reusable tools