Range.with_step
with_stepnew_step
Group: Calculations
Documentation
Creates a copy of this range with a changed step.
Examples
Create a range of even numbers from 0 to 10 (exclusive).
0.up_to 10 . with_step 2 . to_vector == [0, 2, 4, 6, 8]
Create a a decreasing range of even numbers from 10 to 0 (exclusive).
10.down_to 0 . with_step 2 . to_vector == [10, 8, 6, 4, 2]