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

# arc:first

> 僅在 arc:call 或 arc:enum 的第一次迭代中執行指令碼塊，適用於生成標題或檢查物件集中的第一個物件。

export const siteNameShort = "知行之橋";

arc:first 關鍵字是隻在 [arc:call](./op-arc-call) 或 [arc:enum](./op-arc-enum) 的第一次迭代時執行的指令碼。這是一種方便的方法，可以在生成物件集剩餘部分之前生成標題或檢查物件集的第一項。

在第一次迭代中，arc:first 的主體在 [arc:call](./op-arc-call) 或 [arc:enum](./op-arc-enum) 中先於其它程式碼執行，無論 arc:first 在 [arc:call](./op-arc-call) 或 [arc:enum](./op-arc-enum) 主體中的什麼位置。為了起到提醒作用，建議將 arc:first 放到 [arc:call](./op-arc-call) 或 [arc:enum](./op-arc-enum) 主體的頂部。

如果範圍沒有物件，那麼 arc:first 或 [arc:last](./op-arc-last) 都不會執行。

## 參數

無

## 控制屬性

無

## 範例

從物件集中建立一個 HTML 表，其中每個物件都以行的形式表示：

```xml theme={null}
<arc:call op="listCustomers">
  <arc:first>
    <table>
    <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:last>
    </table>
  </arc:last>
</arc:call>
```

## 另請參閱

* [arc:last](./op-arc-last)：只在最後一次迭代時執行的程式碼塊。
