Create an array iterator

This commit is contained in:
Manuel Thalmann 2024-10-16 17:27:33 +02:00
parent 31e890f49b
commit 5f77f62dd9

View file

@ -1,11 +1,10 @@
fn main() { fn main() {
let mut number = 3; let a = [10, 20, 30, 40, 50];
let mut index = 0;
while number != 0 { while index < 5 {
println!("{number}!"); println!("the value is: {}", a[index]);
number -= 1; index += 1;
} }
println!("LIFTOFF!!!");
} }