var arr:Array = ["abc","def"];
arr.insert("ght",atIndex:2);
1)整个元组进行遍历
for begnin arr.enumerate() {
print(begn);
}
2)遍历下标和元素
for (index,element)in arr.enumerate(){
print(index);
print(element);
}
2.数组copy
var str4 = arr;
print(str4);
arr.removeLast();
print(arr);
print(str4);
运行结果:arr变化,str4没有变化