loops in Rust

loops loop for while

There are 3 different loops in Rust

  • for in when we want to iterate over the elements of an iterator.

  • while when don't have the list of things to go over.

  • loop when we want to check the exit condition after the first iteration already started. It is similar to while true, but more idiomatic and can also return a value.

Related Pages

Rust Maven


Gabor Szabo (szabgab)

Gabor Szabo, the author of the Rust Maven web site maintains several Open source projects in Rust and while he still feels he has tons of new things to learn about Rust he already offers training courses in Rust and still teaches Python, Perl, git, GitHub, GitLab, CI, and testing.

Gabor Szabo