---
title: "subscript(_:)"
framework: swift
role: symbol
role_heading: Instance Subscript
path: "swift/dictionary/subscript(_:)-7mdw0"
---

# subscript(_:)

Accesses the value at the given key path.

## Declaration

```swift
subscript(keyPath: [String]) -> USDValue? { get set }
```

## Overview

Overview Reads return nil if no value is present at the path. Assigning a non-nil value sets it at the path, creating intermediate dictionaries as needed; assigning nil erases the value at the path.
