# 06.2 Go函数

**函数** 在任何编程语言中都是重要的元素，因为它可以让您把大块的程序分成比较小而且好管理的小块。函数必须尽可能的彼此独立，而且必须完成单一功能，最好只做一个功能。因此，如果您发现您写的函数做了多个功能，那么您需要考虑用多个函数来取代它！Go 中唯一最常用的函数是 `main()`，它被用在每个独立的 Go 程序中。您应该已经知道了函数的定义用 `func` 关键字开始。


---

# 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://wskdsgcf.gitbook.io/mastering-go-zh-cn/06.0/06.2.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.
