How should I go if I want to iterate with a custom step in stable Rust? Essentially something like the C/C++
for (in
There is way using let "redefinition":
let
for i in 0..((n + 1) / 2) { let i = i * 2; // … }
Or use Iterator::map:
Iterator::map
for i in (0..((n + 1) / 2)).map(|i| i * 2) { // … }