Skip to content

stepBy

stepBy(range: Range, step: Integer)

ParameterTypeDescription
rangeRangeRange to modify
stepIntegerStep size

Changes the step size of the given range. The step size determines how much the range value should increase by after each iteration.

Returns

(Range) The same range.

Example

elk
# 0, 2, 4, 6, 8, 10
for i in 0..10 | stepBy(2): echo(i)
# 0, 2, 4, 6, 8, 10
for i in 0..10 | stepBy(2): echo(i)