Rust-y Scraps: iterating with a step

from blog Steve Klabnik, | ↗ original
May 30 2013 This blog post works with Rust v 0.6, and may change in the future :). A common need in various algorithms is to iterate with some sort of step. A simple way to do this in Rust is with unit::range_step: let nums = [1,2,3,4,5,6,7]; for uint::range_step(0, bytes.len() - 1, 2) |i| { println(fmt!("%d & %d",...