20150706

来源:互联网 发布:怎么开淘宝店铺步骤 编辑:程序博客网 时间:2024/06/07 01:16

1.元组(tuples)把多个值合成一个复合值。

2.元组内的值可以是任意类型,并不要求相同类型。

(404,“Not Found ”)是一个描述http状态码的元组。

//是(int ,String)类型

3.可以在定义元组的时候给单个元素命名:

let http2005Status=(statusCode:200,description:"ok")






//: Playground - noun: a place where people can play


import UIKit


var 张老师 = ("张三",30)

let (name,age) = 张老师


println("\(name)")

println("\(张老师.0)\(张老师.1)")

println("\(name)\(age)")





0 0