> ## 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.

# Block

# \$block

The `$block` operator executes a block of expressions and returns the value of the last expression.

## Input

* An array of expressions to execute in sequence

## Output

* The value of the last expression in the block, or null if the block is empty

## Examples

### Basic Block

```json theme={null}
{
  "$block": [
    {
      "$let": [
        "x",
        5
      ]
    },
    {
      "$let": [
        "y",
        10
      ]
    },
    {
      "$add": [
        {
          "$var": ["x"]
        },
        {
          "$var": ["y"]
        }
      ]
    }
  ]
}
```

Result: `15`

### Block with Early Return

```json theme={null}
{
  "$block": [
    {
      "$let": [
        "value",
        {
          "$input": "input_value"
        }
      ]
    },
    {
      "$ifelse": [
        {
          "$lt": [
            {
              "$var": ["value"]
            },
            0
          ]
        },
        {
          "$return": [
            "negative"
          ]
        },
        {
          "$return": [
            "non-negative"
          ]
        }
      ]
    }
  ]
}
```

Result: `"negative"` if the input\_value is negative, otherwise `"non-negative"`
