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

Declaring tuples

Tuples can hold any number of values, from any number of types. You can declare a tuple with the same types—let's say a 2D point in Double:

let origin = (0.0, 0.0)

You can also name the parameters, as follows:

let point = (x: 10.0, y: 10.0)

The two forms are equivalent, but you may want to use the named version, for readability reasons. If you're referencing a size, for example, the tuple would more accordingly be named (width: Double, height: Double). For obvious reasons, this helps to provide a better understanding of your code.

主站蜘蛛池模板: 吉安市| 莱芜市| 会昌县| 逊克县| 临海市| 嘉荫县| 昌图县| 乌审旗| 临江市| 囊谦县| 怀集县| 吉林省| 垫江县| 房产| 兴安盟| 寿光市| 深泽县| 米林县| 金昌市| 邻水| 纳雍县| 措美县| 额敏县| 青阳县| 阳曲县| 香港| 福海县| 托克托县| 安平县| 三门峡市| 禹城市| 玉屏| 浦北县| 田阳县| 都兰县| 广平县| 嘉祥县| 景洪市| 南华县| 通海县| 怀柔区|