# 如何使用

要開始使用 Pair Programmer，您需要指定您正在使用或想要使用的程式語言。預設情況下，該欄位設置為 Python。

一旦您提交了您的程式語言，您將收到一條類似於以下的消息（雖然確切的措辭可能會有所不同），詳細說明了 Pair Programmer 提供的內容並提供一些有用的命令：

<figure><img src="/files/TRHRKMLKD64CpBgRnGHg" alt="pair programmer example"><figcaption></figcaption></figure>

如果一切看起來正確，您可以將您的程式問題寫入提示區域。

### /change

`/change` 命令允許您在與 Pair Programmer 互動時修改您的偏好設定。目前，它支持兩個選項：

* **程式語言** – 切換程式語言。例如，輸入 `/change language=Java` 以切換到 Java。
* **互動語言** – 更改溝通語言。例如，輸入 `/change language=Spanish` 以切換到西班牙語。

### /implement

`/implement`命令在您想創建新的程序時使用。它遵循五步驟的程序以確保全面的方法：

例如，您可以輸入`/implement task=TaskDescription`。請將`TaskDescription`替換成您希望完成的任務描述。

#### 範例

假設你想實作一個程式，該程式會計算列表中所有元素的總和。

{% code overflow="wrap" %}

```
/implement task=創建一個 Python 函式，該函式會計算列表中所有元素的總和。該函式應該將一個整數列表作為輸入，並返回一個整數作為輸出。
```

{% endcode %}

### /modify

`/modify` 命令用於當您希望對現有程式進行更改或調整。輸入 `/modify code=ProgramCode modifications=ProgramModification`。請將 `ProgramCode` 替換為您希望修改的程式，並將 `ProgramModification` 替換為您希望更改的內容的描述。

#### 範例

例如，假設你有一個 Python 函數可以計算長方形的面積，你想要將它修改成計算圓形面積的函數。

{% code overflow="wrap" %}

```
/修改代碼=
def rectangle_area(length, width):
    return length * width

修改=
將功能更改為使用 `pi * radius^2` 公式計算圓形面積。該函數應接受半徑的單一參數。
```

{% endcode %}

### /test

`/test` 命令是在你希望我為某個程式創建測試案例時使用的。輸入 `/test code=ProgramCode description=ProgramDescription`。請將 `ProgramCode` 替換成你要測試的程式，並用程序描述替換 `ProgramDescription`，說明該程序的功能。

#### 範例

假設你有一個 Python 函數，該函數可以計算數字的階乘，而你想為它創建測試案例

{% code overflow="wrap" %}

```
/test code=
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

description=
這個函數可以計算給定數字的階乘。數字 n 的階乘就是所有小於或等於 n 的正整數的乘積。
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.skydeck.ai/zh-hk/genstudio-workspace/tools/pair-programmer/how-to-use.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
