Swift 元组
阐述
元组是多个值的有序组合,其类型也是多个类型的有序组合。
元组在赋值的时候可以被解构,或者被 .0
这样的下标来访问
实例
let http404Error = (404, "Not Found")
// http404Error is of type (Int, String), and equals (404, "Not Found")
print("The status code is \(http404Error.0)")
// Prints "The status code is 404"
print("The status message is \(http404Error.1)")
// Prints "The status message is Not Found"