已经不再是简单的赋值了,而且数据拷贝!
func testArray(){var a = [1,2,3,4];var b = a;//a.append(100);var c = b;c[1] = 20;print(a); //[1, 2, 3, 4]print(b); //[1, 2, 3, 4]print(c); //[1, 20, 3, 4]
}
已经不再是简单的赋值了,而且数据拷贝!
func testArray(){var a = [1,2,3,4];var b = a;//a.append(100);var c = b;c[1] = 20;print(a); //[1, 2, 3, 4]print(b); //[1, 2, 3, 4]print(c); //[1, 20, 3, 4]
}