Create a loop in Rust

Pascal Precht
InstructorPascal Precht
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

This lesson shows how to use a Rust loop to run a program infinitely.

Instructor: [00:00] To have our program keep asking the user for entering numbers, we can use a loop. Rust comes with several different types of loops. The simplest one is probably the loop loop. All we have to do is wrapping it around our code and closing it here.

[00:19] If we now run the program again, it should continue asking us for numbers. As we can see, once we got the first results, it again asks us for first number and the second number. Now it just continues doing that forever.