Path/Stage 1 · Foundations

Hello, Gopher

Every Go program starts with package main and func main.

Gopher narrator

Have the gopher read this explanation out loud.

A Go program lives inside a package. The main package produces an executable, and execution starts at func main(). fmt is the standard formatting library.

package main

import "fmt"

func main() {
    fmt.Println("Hello, Gopher")
}
Exercise 1·code

Print two lines exactly:

Hello, GoForIt
Ready to learn Go
Plate · main.go
Loading...
Test suite · stdout assertion
  • prints both greetings on their own linespending
Hint

Two Println calls each add their own newline.

Exercise 2·mcq

Which package name makes a Go program build into an executable?

Exercise 3·mcq

What does fmt.Print do that fmt.Println does not?