Create an array iterator
This commit is contained in:
parent
31e890f49b
commit
5f77f62dd9
1 changed files with 5 additions and 6 deletions
|
@ -1,11 +1,10 @@
|
|||
fn main() {
|
||||
let mut number = 3;
|
||||
let a = [10, 20, 30, 40, 50];
|
||||
let mut index = 0;
|
||||
|
||||
while number != 0 {
|
||||
println!("{number}!");
|
||||
while index < 5 {
|
||||
println!("the value is: {}", a[index]);
|
||||
|
||||
number -= 1;
|
||||
index += 1;
|
||||
}
|
||||
|
||||
println!("LIFTOFF!!!");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue