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

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.

主站蜘蛛池模板: 莱西市| 南靖县| 临夏县| 固镇县| 扎囊县| 志丹县| 易门县| 斗六市| 曲麻莱县| 汾阳市| 嫩江县| 宁武县| 若尔盖县| 江陵县| 凤阳县| 涿鹿县| 庆元县| 赞皇县| 弋阳县| 玉田县| 龙南县| 白水县| 山东省| 邵阳市| 尚义县| 盘山县| 麻城市| 昭通市| 焉耆| 临沂市| 滦平县| 偏关县| SHOW| 肃宁县| 鄂尔多斯市| 寿光市| 濮阳市| 会泽县| 彩票| 平凉市| 崇信县|