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 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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue