# 概述

在Swift中提供了三种基本的集合类型。

* Array ： 有序的可重复的
* Set ： 无序的不可重复的
* Dictionary ： 无序的不可重复的字典

![](https://docs.swift.org/swift-book/_images/CollectionTypes_intro_2x.png)

## 集合类型的可变性

如果集合类型被赋予给常量，集合类型则不可更改，不能增加删除元素，也不能修改元素；

如果集合类型赋予给变量，则可以修改。


---

# 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://gitbook.existorlive.cn/kai-fa-yu-yan-xue-xi/swift/4.-ji-he-lei-xing/1.-gai-shu.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.
