From the course: Rust Programming: From Fundamentals to Advanced Concepts with AI-Assisted Development

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Introduction to loops and control flow

Introduction to loops and control flow

- Now that we've seen variables and assignment in Rust, the next step is to take a look at loops. There are different types of loops in Rust, including the wild and the for loop, but there's also a construct named loop. Now it might sound a little bit confusing, especially if you're coming from our languages like JavaScript and Python, where the loops are kind of similar but not quite. And in Rust we'll see some of those differences, including some of the control statements that we'll have to be able to break out of the loops and match certain conditions so that we can effectively control the flow of execution. So you're going to be able to build some code, get into a loop situation, and then fine tune granularly and specifically try to determine when you want to break out or you want to continue doing more execution of more Rust code.

Contents