Monthly Archives: March 2019

Swift5.0基本语法

1、数组

// 定义不可变数组
let array:[String] = ["1", "2", "3", "4"]
print(array)
// 定义可变数组
var mutArray = ["one", "two", "three", "four"]
print(mutArray)
// 修改数组元素值
mutArray[0] = "1";
print(mutArray)
// 根据范围修改元素值
mutArray[1...3] = ["2", "3", "4"]
print(mutArray)
// 增加元素
mutArray += ["five", "six”];
print(mutArray)

[……]

继续阅读