---
title: "subscript(_:)"
framework: foundation
role: symbol
role_heading: Instance Subscript
path: "foundation/nsmutabledictionary/subscript(_:)"
---

# subscript(_:)

Accesses the value associated with a given key.

## Declaration

```swift
@objc override dynamic subscript(key: Any) -> Any? { get set }
```

## Parameters

- `key`: The key whose value you want to retrieve.

## Return Value

Return Value The value associated with the key, or nil if no value is associated with the key.
