Contents

subscript(_:as:default:)

Reads and writes the value at the given index as a floating point value, falling back to the given default value.

Declaration

subscript<T>(index: Int, as type: T.Type = T.self, default defaultValue: @autoclosure () -> T) -> T where T : BinaryFloatingPoint { get }

Parameters

  • index:

    The position of the element to access.

  • type:

    The expected type for the returned value.

  • defaultValue:

    The value to use if no value for exists at index or if conversion to type fails.

Return Value

The value at the specified index in the array.

See Also

Accessing elements