How to make a reverse ordered for loop?

A forward loop is like this:

for x in 0..100 {
    println!("{}", x);
}

And a reverse loop is done by calling Iterator::rev to reverse the order:

for x in (0..100).rev() {
    println!("{}", x);
}

Leave a Comment