Go · Stage 3 – Making Decisions · Lesson 20 of 64

What Is Control Flow?

Understand how a program chooses which instruction runs next.

Go code

fmt.Println("First")
fmt.Println("Second")
Line-by-line explanation
  1. The first line runs first.
  2. The second runs next.
Expected output
First
Second

This is the expected result.

A condition can create a fork in that path, like choosing a road based on a true-or-false sign.