© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
A. FreemanPro Gohttps://doi.org/10.1007/978-1-4842-7355-5_6

6. Flow Control

Adam Freeman1  
(1)
London, UK
 
In this chapter, I describe the Go features for controlling the flow of execution. Go supports keywords that are common in other programming languages, such as if, for, switch, etc., but each has some unusual and innovative features. Table 6-1 puts the Go flow control features in context.
Table 6-1

Putting Flow Control in Context

Question

Answer

What is it?

Flow control allows a programmer to selectively execute statements.

Why is it useful?

Without flow control, an application executes a series of code statements in sequence and then exits. Flow control allows ...

Get Pro Go: The Complete Guide to Programming Reliable and Efficient Software Using Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.