striding(by:)

Returns a sequence stepping through the elements every step starting at the first value. Any remainders of the stride will be trimmed.

Stride.swift:30
func striding(by step: Int) -> StridingSequence<Self>

Parameters

step

The amount to step with each iteration.

Returns

Returns a sequence for stepping through the elements by the specified amount.

(0...10).striding(by: 2) // == [0, 2, 4, 6, 8, 10]
(0...10).striding(by: 3) // == [0, 3, 6, 9]