© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
C. MilanesiBeginning Rusthttps://doi.org/10.1007/978-1-4842-7208-4_4

4. Controlling Execution Flow

Carlo Milanesi1  
(1)
Bergamo, Italy
 
In this chapter, you will learn:
  • How to use if statements to execute different statements based on a Boolean condition

  • How to use if expressions to generate different values based on a Boolean condition

  • How to use while statements to repeat some statements as long as a Boolean condition holds

  • How to use for statements to repeat some statements for a definite number of times

  • What is the scope of validity of variables

Conditional Statements (if)

The main usage of Boolean values, introduced in the previous chapter, is in making decisions ...

Get Beginning Rust: Get Started with Rust 2021 Edition 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.