Functions
13 lessons
- 01Introduction to FunctionsHow to define and call functions in Go, including signatures and parameters.
- 02Multiple ParametersShorthand syntax for declaring multiple parameters of the same type in Go.
- 03Declaration SyntaxWhy Go puts types on the right and how it improves readability.
- 04Pass by ValueUnderstanding how Go passes copies of variables to functions by default.
- 05Ignoring Return ValuesHow to use the blank identifier (_) to discard unwanted return values.
- 06Named Return ValuesDocumenting your function's outputs using named return parameters and naked returns.
- 07Early ReturnsUsing guard clauses to simplify nested logic and improve readability.
- 08Functions as ValuesHow to treat functions as first-class citizens by passing them as arguments to other functions.
- 09Anonymous FunctionsCreating functions without names for one-time use or as closures.
- 10DeferAutomatically executing cleanup logic before a function returns.
- 11Block ScopeHow Go uses lexical scoping to determine variable visibility.
- 12Closures and CurryingAdvanced functional patterns in Go including variable enclosure and partial application.
- 13Functions CheatsheetA quick reference for Go function syntax, return patterns, and scoping.