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

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.

主站蜘蛛池模板: 辛集市| 新营市| 昌邑市| 吉木乃县| 隆尧县| 兴隆县| 镇原县| 宁明县| 东乌珠穆沁旗| 株洲市| 灌云县| 湖口县| 宁城县| 榆中县| 三门峡市| 诸暨市| 墨竹工卡县| 荔波县| 泗洪县| 遵义县| 绍兴市| 开江县| 建昌县| 湾仔区| 怀仁县| 长汀县| 黑水县| 屯留县| 库伦旗| 五大连池市| 丰顺县| 镇远县| 泽库县| 乌兰察布市| 泗水县| 博爱县| 贵阳市| 堆龙德庆县| 汶上县| 和龙市| 崇仁县|