Loop Through Numbers In A Range With A Given Step In Rust

May 2025
fn main() {
  for num in (1..=10).step_by(2) {
    println!("{}", num);
  }
}
Output:
1
3
5
7
9
end of line