For over an array

cat-town
Dan Buch 6 years ago
parent 4ab48a6470
commit 7b25d7660d
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7

@ -1,10 +1,7 @@
fn main() {
let a = [10, 20, 30, 40, 50];
let mut index = 0;
while index < 5 {
println!("the value is: {}", a[index]);
index = index + 1;
for element in a.iter() {
println!("the value is: {}", element);
}
}

Loading…
Cancel
Save