0.2.0 |
|
---|---|
0.1.1 |
|
0.1.0 |
|
#36 in #iterate
11KB
293 lines
grange
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);
}
}