Contents

index(_:offsetBy:)

Returns an index that is the specified distance from the given index.

Declaration

func index(_ i: Int, offsetBy distance: Int) -> Int

Parameters

  • i:

    A valid index of the collection.

  • distance:

    The distance to offset i.

Return Value

An index offset by distance from the index i.

Discussion

The value passed as distance must not offset i beyond the bounds of the collection.

See Also

Getting the index