Use control flows in Go

Beginner
Developer
Student
Azure

Learn how to use control flows in Go.

Learning objectives

In this module, you will:

  • Learn about simple and compound if statements.
  • Learn about switch statements and their features.
  • Learn about loop statements and how Go creates them by using the for keyword.
  • Learn about essential error-handling functions like defer, panic, and recover.

Prerequisites

  • A Go environment that's ready to create applications. Ideally, you should have installed and configured Go locally, and you should have Visual Studio Code installed with the Go extension. Alternatively, you can use the Go Playground.
  • Know how to create and modify .go files.
  • Know how run Go applications by using the Command Prompt window.
  • Know how to declare and initialize variables.
  • Know how to create functions.