Swift 复数变量定义

前端之家收集整理的这篇文章主要介绍了Swift 复数变量定义前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
import Foundation


//Swift 复数变量定义
let myStatus = (411,"大连")
println(myStatus.0)
println(myStatus.1)

//Swift 复数变量定义(带标签)
let myStatusWithlabel: (code: Int,text: String) = (411,"大连")
println(myStatusWithlabel.code)
println(myStatusWithlabel.1)

let myStatusThree: (code: Int,text: String,tel: String) = (411,"大连","080")
println(myStatusThree.code)
println(myStatusThree.1)
println(myStatusThree.tel)


//Swift 复数变量的赋值
let status = (411,"大连")
let (_,msg) = status  //此处只为变量msg赋值
println(msg)

猜你在找的Swift相关文章