[ swift 2.0 ] tuples

跟Python一樣 
swift也支援tuples這個語法
算是滿新的語法
tuple裡面可以放不同資料型態的變數值
let weather  = ("sunny" , 16)
let (status,temperature ) = weather

print(status, temperature)

或用 key : value的方式來宣告
let weather = (status:"rainy" , temperature:8)
print(weather.status,weather.temperature)

留言