var array = ["a","b","c","d"] //声明一个数组
array[0] = "A"
array.append("e") //在数组末尾添加一个元素
array.removeAtIndex(0) //删除数组中第1个元素,从0开始算起
array += ["f"] //在数组末尾添加一个元素
array.removeFirst() //删除数组中第1个元素
array.removeLast() //删除数组中最后一个元素
array.insert("A", atIndex: 0) //向数组中的某个位置插入一个元素
<pre name="code" class="plain">//声明一个字典。声明时,Value不可为nil</span>
<span style="font-family: Arial, Helvetica, sans-serif;">var dict = ["name":"jiluanxi","age":22,"sex":"boy"]</span>
dict["tel"] = 18360538622 //增加一个键值对
dict["tel"] = nil //将一个Key对应的Value置为nil,会默认删除
dict.removeValueForKey("sex") //删除对应Key的Value值
dict.updateValue("Jeason", forKey: "name") //修改对应Key的Value值
var name = dict["name"] //取出对应Key的Value值
print("My name is \(name!)") //可选类型用!来确认
//声明一个元组,元组中可以存放不同类型的值
var student = ("jiluanxi",22,18360538622,"boy")
var stuName = student.0 //取元组中的数据
var stuAge = student.1
var stuTel = student.2
var stuSex = student.3