- vec
- for
Iterate over vector of numbers
examples/iterators/iterator-over-vector-of-numbers/src/main.rs
fn main() { let numbers = vec![1, 2, 3]; println!("{:?}", numbers); for n in &numbers { println!("{}", n); } println!("{:?}", numbers); }
[1, 2, 3] 1 2 3 [1, 2, 3]