I am still just learning Rust but I liked the second one better.
Section: Combining Iterator Adaptors
Sub-section: Complex Chains
for i in (0..=10).rev().filter(|x| x % 2 == 0) { print!("{} ", i); }
for i in (0..=10).rev().step_by(2) { print!("{} ", i); }
Again for:
`let r = (1..20)
.filter(|&x| x % 5 == 0)
.chain((6..9).rev());
for i in r {
print!("{} ", i);
}`
`let r = (5..20)
.step_by(5)
.chain((6..9).rev());
for i in r {
print!("{} ", i);
}`
Thanks for the tutorial,
George
I am still just learning Rust but I liked the second one better.
Section: Combining Iterator Adaptors
Sub-section: Complex Chains
for i in (0..=10).rev().filter(|x| x % 2 == 0) { print!("{} ", i); }for i in (0..=10).rev().step_by(2) { print!("{} ", i); }Again for:
`let r = (1..20)
.filter(|&x| x % 5 == 0)
.chain((6..9).rev());
for i in r {
print!("{} ", i);
}`
`let r = (5..20)
.step_by(5)
.chain((6..9).rev());
for i in r {
print!("{} ", i);
}`
Thanks for the tutorial,
George