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

# arc:finally

> Executes a cleanup section of a script after control leaves an arc:call, arc:try, arc:render, or arc:script statement, regardless of whether an exception occurred.

export const siteNameShort = "Arc";

Use the `arc:finally` keyword to execute a section of a script after control leaves an [arc:call](./op-arc-call), [arc:try](./op-arc-try), [arc:render](./op-arc-render), or [arc:script](./op-arc-script) statement. It is a convenient way to clean up the formatting of generated documents.

## Parameters

None

## Control Attributes

None

## Example

The `arc:finally` block is executed when an unhandled exception occurs. It ensures that tags are closed:

```xml theme={null}
<table>
<arc:call op="listCustomers" out="customer">
  <arc:first>
    <thead>
        <arc:enum item="customer">
          <td>[_attr]</td>
        </arc:enum>
    </thead>
  </arc:first>
  <tr>
      <arc:enum item="customer">
        <td>[_value]</td>
      </arc:enum>
  </tr>
  <arc:finally>
  </table> <!-- ensure tags are still closed -->
  </arc:finally>
</arc:call>
```

## See Also

* [arc:try](./op-arc-try): Define a scope to catch exceptions.
* [arc:call](./op-arc-call): Loop over items returned by an operation.
* [arc:render](./op-arc-render): Generate a document based on an {siteNameShort}Script template.
* [arc:script](./op-arc-script): Create a script block.
