for range over the array, rather than index
This commit is contained in:
parent
5540cb62c4
commit
4247c43b1b
33 changed files with 3 additions and 6 deletions
|
@ -3,12 +3,9 @@ fn main() {
|
||||||
let x: i8 = 15;
|
let x: i8 = 15;
|
||||||
let y: i16 = 1000;
|
let y: i16 = 1000;
|
||||||
|
|
||||||
for i in 0..3 {
|
for i in a {
|
||||||
println!("a[{i}]: {}", a[i]);
|
println!("{}", i);
|
||||||
println!(
|
println!("i * x * y = {}", multiply(i.into(), x.into(), y.into()));
|
||||||
"a[{i}] * x * y = {}",
|
|
||||||
multiply(a[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…
Add table
Add a link
Reference in a new issue