官术网_书友最值得收藏!

Arrays

Unlike in Objective-C, a Swift array can only hold elements of the same type, and it's a value type.

The following code declares an Array container of three Int types,  1, 2, and 3:

let ints = [1,2,3] // Array<Int> or [Int]

As an example, if you wanted them to be Doubles, you could easily force the type on it:

let doubles: [Double] = [1,2,3]
主站蜘蛛池模板: 阿勒泰市| 陇川县| 海盐县| 宁化县| 罗田县| 抚远县| 阿城市| 洛川县| 南郑县| 平阴县| 澜沧| 南和县| 龙门县| 武邑县| 元阳县| 德州市| 萝北县| 龙陵县| 盐城市| 普定县| 文水县| 大竹县| 股票| 商河县| 饶平县| 米林县| 尚义县| 嘉善县| 庆城县| 黑龙江省| 永丰县| 夏津县| 邵东县| 西华县| 大冶市| 双牌县| 磐石市| 奉化市| 新营市| 改则县| 曲靖市|