While

Repeat while the condition is true.

while

Update the variable inside the loop until the condition becomes false (or you get an infinite loop).

fn main() {
    let mut i = 0
    while i < 3 {
        print(i)
        i = i + 1
    }
}

Output

0
1
2