Stage 1 · Code
Programming Foundations
Functions
Function signatures, variadic args, closures, and first-class functions.
Function Signatures
Go functions are declared with func, followed by name, parameters (name type), and return types. Parameters of same type can share type declaration.
Multiple Return Values
Go's multiple returns are idiomatic for returning value + error, or multiple computed values. No tuple allocation overhead.
Variadic Functions
Variadic functions accept variable number of arguments. Inside, the parameter is a slice. Call with multiple args or a slice with ....
Closures
A closure is a function that captures variables from its surrounding scope. The captured variables are shared between the closure and the outer scope.
First-Class Functions
Functions are values — assign to variables, pass as arguments, return from functions. Enables higher-order functions and functional patterns.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.