- 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.
推薦閱讀
- ETL數(shù)據(jù)整合與處理(Kettle)
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場景與數(shù)據(jù)產(chǎn)品
- Effective Amazon Machine Learning
- 卷積神經(jīng)網(wǎng)絡(luò)的Python實現(xiàn)
- 分布式數(shù)據(jù)庫系統(tǒng):大數(shù)據(jù)時代新型數(shù)據(jù)庫技術(shù)(第3版)
- SQL查詢:從入門到實踐(第4版)
- 大數(shù)據(jù):規(guī)劃、實施、運維
- 大數(shù)據(jù)時代下的智能轉(zhuǎn)型進程精選(套裝共10冊)
- Ceph源碼分析
- Hadoop 3.x大數(shù)據(jù)開發(fā)實戰(zhàn)
- MATLAB Graphics and Data Visualization Cookbook
- Apache Kylin權(quán)威指南
- Gideros Mobile Game Development
- Oracle 11g+ASP.NET數(shù)據(jù)庫系統(tǒng)開發(fā)案例教程
- 一本書讀懂大數(shù)據(jù)