Lesson 3 of 60
GoBasic Syntax: Packages, Functions, and Variables
20 minutes
Basic Syntax: Packages, Functions, and Variables
This lesson explains how Go programs are structured and how to declare values, variables, and functions.
Packages
Every Go source file starts with a package declaration. A package groups related Go files together.
package main
The main package is used for executables. Other packages are reusable libraries.
Imports
Use to bring in code from the standard library or external modules.