Chapter 3. Go Control Flow
Go borrows several of its control flow syntax from the C-family of languages. It supports all of the expected control structures, including if...else
, switch
, for
loop, and even goto
. Conspicuously absent, though, are while
or do...while
statements. The following topics in this chapter examine Go's control flow elements, some of which you may already be familiar with, and others that bring a new set of functionalities not found in other languages:
The
if
statementThe
switch
statementThe type
Switch
The
for
statement