- Hands-On Design Patterns with Swift
- Florent Vilmart Giordano Scalzo Sergio De Simone
- 99字
- 2021-07-02 14:45:01
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.
推薦閱讀
- 云數(shù)據(jù)中心基礎(chǔ)
- 云計(jì)算環(huán)境下的信息資源集成與服務(wù)
- 數(shù)字IC設(shè)計(jì)入門(mén)(微課視頻版)
- Augmented Reality using Appcelerator Titanium Starter
- Hadoop 3實(shí)戰(zhàn)指南
- Visual Studio 2013 and .NET 4.5 Expert Cookbook
- 商業(yè)智能工具應(yīng)用與數(shù)據(jù)可視化
- 數(shù)據(jù)賦能
- Kubernetes快速進(jìn)階與實(shí)戰(zhàn)
- Oracle 11g數(shù)據(jù)庫(kù)管理與開(kāi)發(fā)基礎(chǔ)教程
- 云原生架構(gòu):從技術(shù)演進(jìn)到最佳實(shí)踐
- Practical Convolutional Neural Networks
- Applying Math with Python
- 大學(xué)計(jì)算機(jī):理解和運(yùn)用計(jì)算思維
- 2D 計(jì)算機(jī)視覺(jué):原理、算法及應(yīng)用