for range over the array, rather than index
This commit is contained in:
parent
5540cb62c4
commit
4247c43b1b
|
@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue