> 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/3-go-ji-ben-shu-ju-lei-xing/03.1/03.1.3.md).

# 03.1.3 range关键字

Go同时提供了range关键字，它能配合for循环以帮助你在遍历Go的数据类型时写出更易于理解的代码。

range关键字的主要优势在于并不需要知道一个切片或者字典的长度就可以一个接一个的对它们的元素进行操作。稍后你会看到range的示例。
