Module 3 · Lesson 1 of 511/50 in the course~10 min
Module lessons (1/5)
Signature and parameters
Lesson preview5 hands-on exercises readyCourse Go · Module 3 — Functions
Syntax func nome(p tipo) tipo, pass by default value, parameters of the same type grouped.
What you'll learn in this lesson
- Writing idiomatic function signatures in Go with typed parameters and explicit return values.
- Recognize the pass-by-default value and the capitalization-based export rule.
- Pass functions as values and parameters to other functions (
first-class functions).
Overview
In Go, the type of each parameter follows its name rather than preceding it: the signature naturally reads from left to right like a sentence.
In Go all arguments are passed by value: the function receives a copy. If you want to modify the original variable of the caller you must pass a *T pointer (or mutate the internal elements of a slice/map).
Sections covered in this lesson
- 1Signature syntax and type grouping
- 2Passing by value and visibility between packages
- 3Functions as first-class values
- 4
mainandinit: the two reserved entry points - 5Guided practice
- 6Check for understanding
Pro Lesson · Module 3 — Functions
Unlock "Signature and parameters" and the full Course Go curriculum
Syntax `func nome(p tipo) tipo`, pass by default value, parameters of the same type grouped.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course Go plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.