> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# Function: mergeStatements()

> **mergeStatements**(`existing`: `string`, `patch`: `string`, `rootId?`: `string`): `string`

Merge an existing program with a patch (partial update).
Patch statements override existing ones by name.
Unreachable statements are automatically garbage-collected.
Returns the merged program as a string.

## Parameters

| Parameter  | Type     |
| ---------- | -------- |
| `existing` | `string` |
| `patch`    | `string` |
| `rootId?`  | `string` |

## Returns

`string`
