Check out example codes for "loop in rust". It will help you in understanding the concepts better.

Code Example 1

#![allow(unused_variables)]
fn main() {
let mut x = 5; // mut x: i32
let mut done = false; // mut done: bool

while !done {
    x += x - 3;

    println!("{}", x);

    if x % 5 == 0 {
        done = true;
    }
}
}

Learn ReactJs, React Native from akashmittal.com