> For the complete documentation index, see [llms.txt](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wskdsgcf.gitbook.io/mastering-go-zh-cn/06.0/06.2.md).

# 06.2 Go函数

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