> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Var

# \$var

The `$var` operator retrieves the value of a variable from the current scope.

## Input

* A single string value representing the variable name

## Output

* The value of the variable, or null if the variable is not defined

## Examples

### Retrieve Variable Value

```json theme={null}
{
  "$var": [
    "x"
  ]
}
```

Result: The value of variable x, or null if x is not defined

### Use with Let in a Block

```json theme={null}
{
  "$block": [
    {
      "$let": [
        "name",
        "Alice"
      ]
    },
    {
      "$concat": [
        "Hello, ",
        {
          "$var": ["name"]
        },
        "!"
      ]
    }
  ]
}
```

Result: `"Hello, Alice!"`

### Variable Not Defined

```json theme={null}
{
  "$var": [
    "undefined_variable"
  ]
}
```

Result: `null`
