#range #iterate #macro #numbres

yanked grange

create range numbers macro

0.2.0 Jul 11, 2019
0.1.1 May 24, 2019
0.1.0 May 23, 2019

#38 in #iterate

MIT license

11KB
293 lines

grange

Crates.io Build Status Build status License: MIT

create range numbers in rust

add dependency

cargo add grange

or

grange = "0.1.*"

example

use grange::*;

fn main() {
    for i in range!(1,2,=20){ // equal to (1..=20).step_by(2)
        println!("{}", i);
    }
    for i in range!(10,-1,=1){ // equal to (1..=10).rev() 
        println!("{}", i);
    }
    for i in range!(10,-2,=1){  // equal to (1..=10).step_by(2)
        println!("{}", i);
    }
    for i in range!(,3,10){ // equal to (0..10).step_by(3)
        println!("{}", i);
    }
    for i in range!("10..1"){  
        println!("{}", i);
    }
}

No runtime deps