Functions (Parameters, Returns & Separate Files) - Go Tutorial for Beginners #11
8views
0011:36
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Master Go functions - the building blocks of reusable code!
In this lesson, you will learn:
✓ Function declaration and syntax
✓ Parameters - single, multiple, and mixed types
✓ Return values and the return keyword
✓ Multiple return values (Go's superpower!)
✓ Error handling with value + error pattern
✓ Named return values for documentation
✓ Organizing functions in separate files (main.go + utils.go)
⏱️ Timestamps:
0:00 - Introduction
0:24 - Function Basics (Parameters)
2:23 - Return Values & Multiple Returns
4:49 - Named Return Values
7:01 - Functions in Separate Files
10:11 - Recap
10:41 - End
💻 Source Code: https://github.com/GoCelesteAI/go_functions
📝 Code Highlights:
// Basic function with parameters
func greet(name string) {
fmt.Println("Hello,", name)
}
// Function with return value
func add(a, b int) int {
return a + b
}
// Multiple return values
func divmod(a, b int) (int, int) {
return a / b, a % b
}
// Named return values
func rectangle(w, h float64) (area, perimeter float64) {
area = w * h
perimeter = 2 * (w + h)
return
}
// Separate files: utils.go
func Add(a, b int) int { return a + b }
// main.go uses utils.go - same package, no import needed!
sum := Add(10, 20)
📺 Full Playlist: Go Tutorial for Beginners
📺 Previous: Lesson 10 - Maps
📺 Next: Lesson 12 - Variadic Functions
👍 Like and Subscribe for more Go tutorials!
#Go #Golang #Programming #Tutorial #Functions #GoProgramming #LearnToCode
Back to tutorialsOpen in YouTube
Duration
11:36
Published
February 1, 2026
Added to Codegiz
March 15, 2026