---
title: "subscript(_:as:default:)"
framework: xpc
role: symbol
role_heading: Instance Subscript
path: "xpc/xpcarray/subscript(_:as:default:)-3k2qm"
---

# 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

```swift
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

Return Value The value at the specified index in the array.

## See Also

### Accessing elements

- [subscript(_:)](xpc/xpcarray/subscript(_:)-1s7qq.md)
- [subscript(_:)](xpc/xpcarray/subscript(_:)-6c9gh.md)
- [subscript(_:)](xpc/xpcarray/subscript(_:)-i6v5.md)
- [subscript(_:)](xpc/xpcarray/subscript(_:)-56wjj.md)
- [subscript(_:)](xpc/xpcarray/subscript(_:)-8wubg.md)
- [subscript(_:)](xpc/xpcarray/subscript(_:)-9x9ho.md)
- [subscript(_:)](xpc/xpcarray/subscript(_:)-2f94n.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-3ae6x.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-9ukjj.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-1bilh.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-931lh.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-3tgp4.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-2hql9.md)
- [subscript(_:as:)](xpc/xpcarray/subscript(_:as:)-6grs4.md)
- [subscript(_:as:default:)](xpc/xpcarray/subscript(_:as:default:)-2bn95.md)
