6
Control Flow
Control flow is the path of execution through your source code. Execution could start at main and execute source statements in order until the end of the function. This approach works for only the simplest of programs, such as a hello, world application. Even the most mundane application requires some level of variability in code execution, such as arcs and various branches. Transfer of control is the most common method for nonconsecutive execution and the focus of this chapter.
Rust has the usual suspects of keywords determining the control path and causing a transfer of control within an application. This includes the following expressions:
ifloopwhileformatch
Of course, Rust applies its own viewpoint to these familiar ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access