I am a Rust beginner and could not find anything regarding this in the docs. Would appreciate any help. The following loop in C++
for (const int i : {1,2,3,4,5})
cout << i;
roughly translates into
for &i in &[1,2,3,4,5] {
println!("{}", i);
}
Is there a way to write the equivalent of
for (int i : {1,2,3,4,5}) {
i += 1;
cout << i;
}
in Rust concisely? Namely is there a shorthand to make a local mutable copy of whats being iterated over?