# TryGetValue(string, out IVariable)

> Gets the variable with the matching key if one exists.

## Definition

* **Type:** Method
* **Namespace:** [Unity.SmartStrings.PersistentVariables](/engine/6000.7/script-reference/unity/smartstrings/persistentvariables.md)
* **Assembly:** UnityEngine.SmartStringsModule

## TryGetValue(string, IVariable)

```csharp
bool TryGetValue(string key, out IVariable value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The variable key or name to match.**** (\[IVariable]\(/engine/6000.7/script-reference/unity/smartstrings/persistentvariables/ivariable)): The found variable or `null` if one could not be found.

### Returns

| Type                                                          | Description                                                      |
| ------------------------------------------------------------- | ---------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if a variable could be found or `false` if one could not. |
