- for
- in
Iterate over elements of vector using for-loop
- We can iterate over the elements of a vector using the for .. in .. loop construct.
examples/vectors/numbers-iterate/src/main.rs
fn main() { let numbers = vec![10, 11, 12]; for num in numbers { println!("{}", num); } }
10 11 12