定义一个Double型数组的方法
var arr:Array<Double> = []
arr.append(9.9)
var arr1 = Array<Double>()
arr1.append(10.9)
var arr2 = [Double]()
arr2.append(7.7)
var arr3 = [9.1]
var arr4:Array<Double> = [8, 1]
// 数组相加
var array2 = [Int](count: 5, repeatedValue: 10)
var array3 = [8, 9, 8]
var array4 = array2 + array3
// 定义一个空字符串
var string1 = ""
var string2:String = ""
var string3 = String()
var string4:String = String()
时间: 2024-10-25 18:50:11