For over an array
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let a = [10, 20, 30, 40, 50];
|
let a = [10, 20, 30, 40, 50];
|
||||||
let mut index = 0;
|
|
||||||
|
|
||||||
while index < 5 {
|
for element in a.iter() {
|
||||||
println!("the value is: {}", a[index]);
|
println!("the value is: {}", element);
|
||||||
|
|
||||||
index = index + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user