for range over the array, rather than index

This commit is contained in:
Vincent Batts 2023-01-14 21:12:23 -05:00
parent 5540cb62c4
commit 4247c43b1b
33 changed files with 3 additions and 6 deletions

View File

@ -3,12 +3,9 @@ fn main() {
let x: i8 = 15;
let y: i16 = 1000;
for i in 0..3 {
println!("a[{i}]: {}", a[i]);
println!(
"a[{i}] * x * y = {}",
multiply(a[i].into(), x.into(), y.into())
);
for i in a {
println!("{}", i);
println!("i * x * y = {}", multiply(i.into(), x.into(), y.into()));
}
}

Binary file not shown.