> For the complete documentation index, see [llms.txt](https://go.netdpi.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://go.netdpi.net/functions.md).

# 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() {}
```

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