Fix the Step
This code should print the numbers 1, 3, 5, 7, 9 but something is wrong with the step. Can you fix it?
Expected output:
text
1 3 5 7 9
Hints:
- Check the starting number — should it start at 0 or 1?
- Check the step size — is it skipping the right amount?
- Remember to wrap the range in parentheses when using
.step_by()
rust
fn main() {
for i in (0..10).step_by(3) {
println!("{}", i);
}
}