# 07-函式

函式就是一段獨立的程式碼，有零個到多個輸入參數，而且也有零個到多個輸出參數。函式（也稱為 procedure 或 subroutine）通常使用一個黑盒子來表示：

<br>

<figure><img src="https://web.archive.org/web/20200228045708im_/http://golang-zhtw.netdpi.net/_/rsrc/1401643334480/07-han-shi/07-01.png" alt=""><figcaption></figcaption></figure>

<br>

到目前為止，我們在 Go 程式裡面只有用到一個函式：

```
func main() {}
```

現在我們會開始用多個函式來寫程式。


---

# 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://go.netdpi.net/functions.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.
