Rust array iterate over idices
examples/arrays/iterate-on-index/src/main.rs
#[allow(clippy::needless_range_loop)] fn main() { let numbers: [i32; 3] = [10, 11, 12]; for ix in 0..numbers.len() { println!("{} {}", ix, numbers[ix]); } }
0 10 1 11 2 12
#[allow(clippy::needless_range_loop)] fn main() { let numbers: [i32; 3] = [10, 11, 12]; for ix in 0..numbers.len() { println!("{} {}", ix, numbers[ix]); } }
0 10 1 11 2 12